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


Manual Reference Pages  -  DATETIME::FISCAL::YEAR (3)

.ds Aq ’

NAME

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

CONTENTS

SYNOPSIS



  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 );



DESCRIPTION

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.

USAGE

This module implements the following methods:
o 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.

o 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.

o 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.

o 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.

o 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

Support for this module can be obtained from:

datetime@perl.org

AUTHOR

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

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.

SEE ALSO

DateTime.pm, datetime@perl.org mailing list

http://datetime.perl.org

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


perl v5.20.3 DATETIME::FISCAL::YEAR (3) 2016-04-03

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