Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

Calendar::Functions
A module containing functions for dates and calendars.

Calendar::Functions - A module containing functions for dates and calendars.


NAME

Calendar::Functions - A module containing functions for dates and calendars.


SYNOPSIS


  use Calendar::Functions;

  $ext = ext($day);

  $moty = moty($monthname);

  $monthname = moty($moty);

  $dotw = dotw($dayname);

  $dayname = dotw($dotw);

  use Calendar::Functions qw(:dates);

  my $dateobj = encode_date($day,$month,$year);

  ($day,$month,$year) = decode_date($dateobj);

  $duration = diff_dates($dateobj1, $dateobj2);

  $hash = month_list($month,$year);

  $days = month_days($month,$year);

  use Calendar::Functions qw(:form);

  $str = format_date( $fmt, $day, $month, $year, $dotw);

  $str = reformat_date( $date, $fmt1, $fmt2 );

  use Calendar::Functions qw(:all);

  $dotw = dotw3($day,$month,$year);

  $dotw = dotw3($dateobj);

  fail_range($year);


DESCRIPTION

The module is intended to provide numerous support functions for other date and/or calendar functions


EXPORT


  ext, moty, dotw

  dates:    encode_date, decode_date, diff_dates,

            month_list, month_days

  form:     format_date, reformat_date

  all:      encode_date, decode_date, diff_dates,

            month_list, month_days,

            format_date, reformat_date,

            ext, moty, dotw,

            dotw3, fail_range


FUNCTIONS

encode_date( DD, MM, YYYY )
Translates the given date values into a date object or number.

decode_date( date )
Translates the given date values into a date object or number.

diff_dates( date, date )
Using the appropriate module finds the duration between the two dates.

month_list( month, year )
Given a numerical month (1-12) and year, a hash of days for that month are returned, with each day being the key and the day of the week being the value.

dotw3( day, month, year | dateobj )
Given a numerical representation of a date (day, month (1-12) and year), or a date object (as provided by encode_date), the value for day of the week is calculated and returned.

month_days( month, year )
For any given month (1-12) and year, will return the number of days in that month. Note that this relies on other modules to give an accurate leap year calculation.

format_date( fmt, day, mon, year [, dotw])
transposes the standard date values into a formatted string.

reformat_date( date, form1, form1 )
transposes the standard date values into a formatted string.

ext( day )
Returns the extension associated with the given day value.

dotw( day | dayname )
Returns the day number (0..6) if passed the day name, or the day name if passed a numeric.

moty( month | monthname )
Returns the month number (1..12) if passed the month name, or the month name if passed a numeric.

fail_range( year )
Returns true or false based on whether the date given will break the basic date range, 01-01-1902 to 31-12-2037.


DATE FORMATS

Parameters
The date formatting parameters passed to the two formatting functions can take many different formats. A formatting string can contain several key strings, which will be replaced with date components. The following are key strings which are currently supported:

  DD

  MM

  YYYY

  DAY

  MONTH

  DDEXT

  DMY

  MDY

  YMD

  MABV

  DABV

The first three are tranlated into the numerical day/month/year strings. The DAY format is translated into the day of the week name, and MONTH is the month name. DDEXT is the day with the appropriate suffix, eg 1st, 22nd or 13th. DMY, MDY and YMD default to '13-09-1965' (DMY) style strings. MABV and DABV provide 3 letter abbreviations of MONTH and DAY respectively.


DATE MODULES

Internal to this module is some date comparison code. As a consequence this requires some date modules that can handle a wide range of dates. There are three modules which are tested for you, these are, in order of preference, DateTime, Date::ICal and Time::Local.

Each module has the ability to handle dates, although only Time::Local exists in the core release of Perl. Unfortunately Time::Local is limited by the Operating System. On a 32bit machine this limit means dates before 1st January 1902 and after 31st December 2037 will not be represented. If this date range is well within your scope, then you can safely allow the module to use Time::Local. However, should you require a date range that exceedes this range, then it is recommended that you install one of the two other modules.


ERROR HANDLING

In the event that Time::Local is being used and dates that exceed the range of 1st January 1902 to 31st December 2037 are passed, an undef is returned.


SEE ALSO


  Date::ICal

  DateTime

  Time::Local

  Time::Piece

  The Calendar FAQ at http://www.tondering.dk/claus/calendar.html


BUGS, PATCHES & FIXES

There are no known bugs at the time of this release. However, if you spot a bug or are experiencing difficulties that are not explained within the POD documentation, please submit a bug to the RT system (see link below). However, it would help greatly if you are able to pinpoint problems or even supply a patch.

Fixes are dependant upon their severity and my availablity. Should a fix not be forthcoming, please feel free to (politely) remind me by sending an email to barbie@cpan.org .

RT: http://rt.cpan.org/Public/Dist/Display.html?Name=Calendar-List

Known Issues

DateTime & delta_days
DateTime after 0.16 implements delta_days differently from previous versions. Until I have time to rewrite this module to be compatible with versions after 0.16, I won't be supporting DateTime 0.17 or greater.


AUTHOR


  Barbie, <barbie@cpan.org>

  for Miss Barbell Productions <http://www.missbarbell.co.uk>;.


THANKS TO

Dave Cross, <dave at dave.org> for creating Calendar::Simple, the newbie poster on a technical message board who inspired me to write the original wrapper code and Richard Clamp <richardc at unixbeard.co.uk> for testing the beta versions.


COPYRIGHT AND LICENSE


    Copyright  2003-2007 Barbie for Miss Barbell Productions.

    This library is free software; you can redistribute it and/or modify it under

    the same terms as Perl itself, using the Artistic License.

The full text of the licenses can be found in the Artistic file included with this distribution, or in perlartistic file as part of Perl installation, in the 5.8.1 release or later.

Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy