GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
DateTime::Fiscal::Year(3) User Contributed Perl Documentation DateTime::Fiscal::Year(3)

DateTime::Fiscal::Year - Calculate the day or week of the Fiscal Year with an arbitrary start date

  use DateTime;
  use DateTime::Fiscal::Year;

  my $dt = DateTime->new(year=>2003, month=>02, day=>01);
  my $dt2 = DateTime->new(year=>2003, month=>03, day=>01);

  my $fiscal = DateTime::Fiscal::Year->new( start => $dt );

  $fiscal->day_of_fiscal_year( $dt2 );

        or

  $fiscal->week_of_fiscal_year( $dt2 );

        or

  $fiscal->period_of_fiscal_year( 12, $dt2 );

        or 

  $fiscal->quarter_fiscal_year( 13, $dt2 );

This module allows you to calulate the day, week, period or quarter of a date in a fiscal year, given a start date and either a target date or number of periods and target date. This is often needed in business, where the fiscal year begins and ends on different days than the calendar year. This module is based on the Gregorian calendar. Using other DT calendar objects will return results, but the behavior is unpredicatable for calendars that have more than 365 or 366 days.

This module implements the following methods:
  • new(start => $dt)

    The new() method has one named parameter start. The argument to start is a valid DateTime object. This date is the first day of the fiscal year and is used to calculate the offset for the target date.

  • day_of_fiscal_year( $dt2 )

    Returns the day of the fiscal year as calculated from the start date given $dt2 is a valid DateTime object.

      my $dt = DateTime->new(year=>2003, month=>02, day=>01);
      my $dt2 = DateTime->new(year=>2003, month=>03, day=>01);
    
      my $fiscal = DateTime::Fiscal::Year->new( start => $dt );
    
      my $dofy = $fiscal->day_of_fiscal_year( $dt2 );
        

    Day of fiscal year ($dofy) is 29. If given the same day for start and target, the value is 1.

  • week_of_fiscal_year( $dt2 )

    Returns the week of the fiscal year as calculated from the start date given $dt2 is a valid DateTime object.

      my $dt = DateTime->new(year=>2003, month=>02, day=>01);
      my $dt2 = DateTime->new(year=>2003, month=>03, day=>01);
    
      my $fiscal = DateTime::Fiscal::Year->new( start => $dt );
    
      my $wofy = $fiscal->week_of_fiscal_year( $dt2 );
        

    Week of fiscal year ($wofy) is 5. There is not a week 0 or 53. This module was built to assist in financial applications not to satisfy the ISO.

  • period_of_fiscal_year( <number of periods> , $dt2 )

    Returns the period of the fiscal year given the first argument is the number of fiscal periods and the second argument is a valid DateTime object. Right now the only acceptable number of periods is either 12 or 13.

  • quarter_of_fiscal_year( <number of periods>, $dt2 )

    Returns the quarter of the fiscal year given the first argument is the number of fiscal periods and the second argument is a valid DateTime object. Right now the only acceptable number of periods is either 12 or 13.

Support for this module can be obtained from:

datetime@perl.org

Jesse Shy <jshy@pona.net>, thanks to Dave Rolsky for being brave enough to start the perl date-time project. I hope this helps anyone who has to build programs that due financial date calculations.

Copyright (c) 2003 Jesse Shy. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

DateTime.pm, datetime@perl.org mailing list

http://datetime.perl.org

2022-04-08 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.