Barbie > Calendar-List-0.25 > Calendar::Functions

Download:
Calendar-List-0.25.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.25   Source   Latest Release: Calendar-List-0.26

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,$dotw) = decode_date($dateobj);
  $cmp = compare_dates($dateobj1, $dateobj2);

  use Calendar::Functions qw(:form);
  $str = format_date( $fmt, $day, $month, $year, $dotw);
  $str = reformat_date( $date, $fmt1, $fmt2 );

  use Calendar::Functions qw(:all);
  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, compare_dates, add_day

  form:     format_date, reformat_date

  all:      encode_date, decode_date, compare_dates, add_day
            format_date, reformat_date,
            ext, moty, dotw, 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 object into date values.

compare_dates( date, date )

Using the appropriate method, determines ther ordering of the two given dates.

add_day( date )

Add one day to the date object.

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 dependent upon their severity and my availability. 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

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 (C) 2003-2012 Barbie for Miss Barbell Productions

  This module is free software; you can redistribute it and/or
  modify it under the Artistic License v2.
syntax highlighting: