Date::Manip 5.44 review

by on

Date::Manip is a date manipulation routines. SYNOPSIS use Date::Manip; $version = DateManipVersion; $date = ParseDate(

License: Perl Artistic License
File size: 138K
Developer: Sullivan Beck
0 stars award from

Date::Manip is a date manipulation routines.


use Date::Manip;

$version = DateManipVersion;

$date = ParseDate(@args);
$date = ParseDate($string);
$date = ParseDate($string);

@date = UnixDate($date,@format);
$date = UnixDate($date,@format);

$delta = ParseDateDelta(@args);
$delta = ParseDateDelta($string);
$delta = ParseDateDelta($string);

@str = Delta_Format($delta,$dec,@format);
$str = Delta_Format($delta,$dec,@format);

$recur = ParseRecur($string,$base,$date0,$date1,$flags);
@dates = ParseRecur($string,$base,$date0,$date1,$flags);

$flag = Date_Cmp($date1,$date2);

$d = DateCalc($d1,$d2 [,$errref] [,$del]);

$date = Date_SetTime($date,$hr,$min,$sec);
$date = Date_SetTime($date,$time);

$date = Date_SetDateField($date,$field,$val [,$nocheck]);

$date = Date_GetPrev($date,$dow,$today,$hr,$min,$sec);
$date = Date_GetPrev($date,$dow,$today,$time);

$date = Date_GetNext($date,$dow,$today,$hr,$min,$sec);
$date = Date_GetNext($date,$dow,$today,$time);

$name = Date_IsHoliday($date);

$listref = Events_List($date);
$listref = Events_List($date0,$date1);

$date = Date_ConvTZ($date);
$date = Date_ConvTZ($date,$from);
$date = Date_ConvTZ($date,"",$to);
$date = Date_ConvTZ($date,$from,$to);

$flag = Date_IsWorkDay($date [,$flag]);

$date = Date_NextWorkDay($date,$off [,$time]);

$date = Date_PrevWorkDay($date,$off [,$time]);

$date = Date_NearestWorkDay($date [,$tomorrowfirst]);

@list = Date_Init();
@list = Date_Init("VAR=VAL","VAR=VAL",...);

The above routines all check to make sure that Date_Init is called. If it hasn't been, they will call it automatically. As a result, there is usually no need to call Date_Init explicitely unless you want to change some of the config variables (described below). They also do error checking on the input.

The routines listed below are intended primarily for internal use by other Date::Manip routines. They do little or no error checking, and do not explicitely call Date_Init. Those functions are all done in the main Date::Manip routines above.

Because they are significantly faster than the full Date::Manip routines, they are available for use with a few caveats. Since little or no error checking is done, it is the responsibility of the programmer to ensure that valid data (AND valid dates) are passed to them. Passing invalid data (such as a non-numeric month) or invalid dates (Feb 31) will fail in unpredictable ways (possibly returning erroneous results). Also, since Date_Init is not called by these, it must be called explicitely by the programmer before using these routines.

In the following routines, $y may be entered as either a 2 or 4 digit year (it will be converted to a 4 digit year based on the variable YYtoYYYY described below). Month and day should be numeric in all cases. Most (if not all) of the information below can be gotten from UnixDate which is really the way I intended it to be gotten, but there are reasons to use these (these are significantly faster).

$day = Date_DayOfWeek($m,$d,$y);
$secs = Date_SecsSince1970($m,$d,$y,$h,$mn,$s);
$secs = Date_SecsSince1970GMT($m,$d,$y,$h,$mn,$s);
$days = Date_DaysSince1BC($m,$d,$y);
$day = Date_DayOfYear($m,$d,$y);
($y,$m,$d,$h,$mn,$s) = Date_NthDayOfYear($y,$n);
$days = Date_DaysInYear($y);
$days = Date_DaysInMonth($m,$y);
$wkno = Date_WeekOfYear($m,$d,$y,$first);
$flag = Date_LeapYear($y);
$day = Date_DaySuffix($d);
$tz = Date_TimeZone();

Date::Manip 5.44 search tags