Blame lib/Date/Manip/DM5.pod

Packit 95306a
=pod
Packit 95306a
Packit 95306a
=head1 NAME
Packit 95306a
Packit 95306a
Date::Manip::DM5 - Date manipulation routines
Packit 95306a
Packit 95306a
=head1 SYNOPSIS
Packit 95306a
Packit 95306a
 use Date::Manip;
Packit 95306a
Packit 95306a
 $version = DateManipVersion;
Packit 95306a
Packit 95306a
 Date_Init();
Packit 95306a
 Date_Init("VAR=VAL","VAR=VAL",...);
Packit 95306a
 @list = Date_Init();
Packit 95306a
 @list = Date_Init("VAR=VAL","VAR=VAL",...);
Packit 95306a
Packit 95306a
 $date = ParseDate(\@args);
Packit 95306a
 $date = ParseDate($string);
Packit 95306a
 $date = ParseDate(\$string);
Packit 95306a
Packit 95306a
 @date = UnixDate($date,@format);
Packit 95306a
 $date = UnixDate($date,@format);
Packit 95306a
Packit 95306a
 $delta = ParseDateDelta(\@args);
Packit 95306a
 $delta = ParseDateDelta($string);
Packit 95306a
 $delta = ParseDateDelta(\$string);
Packit 95306a
Packit 95306a
 @str = Delta_Format($delta,$dec,@format);
Packit 95306a
 $str = Delta_Format($delta,$dec,@format);
Packit 95306a
Packit 95306a
 $recur = ParseRecur($string,$base,$date0,$date1,$flags);
Packit 95306a
 @dates = ParseRecur($string,$base,$date0,$date1,$flags);
Packit 95306a
Packit 95306a
 $flag = Date_Cmp($date1,$date2);
Packit 95306a
Packit 95306a
 $d = DateCalc($d1,$d2 [,$errref] [,$del]);
Packit 95306a
Packit 95306a
 $date = Date_SetTime($date,$hr,$min,$sec);
Packit 95306a
 $date = Date_SetTime($date,$time);
Packit 95306a
Packit 95306a
 $date = Date_SetDateField($date,$field,$val [,$nocheck]);
Packit 95306a
Packit 95306a
 $date = Date_GetPrev($date,$dow,$today,$hr,$min,$sec);
Packit 95306a
 $date = Date_GetPrev($date,$dow,$today,$time);
Packit 95306a
Packit 95306a
 $date = Date_GetNext($date,$dow,$today,$hr,$min,$sec);
Packit 95306a
 $date = Date_GetNext($date,$dow,$today,$time);
Packit 95306a
Packit 95306a
 $name = Date_IsHoliday($date);
Packit 95306a
Packit 95306a
 $listref = Events_List($date);
Packit 95306a
 $listref = Events_List($date0,$date1);
Packit 95306a
Packit 95306a
 $date = Date_ConvTZ($date);
Packit 95306a
 $date = Date_ConvTZ($date,$from);
Packit 95306a
 $date = Date_ConvTZ($date,"",$to);
Packit 95306a
 $date = Date_ConvTZ($date,$from,$to);
Packit 95306a
Packit 95306a
 $flag = Date_IsWorkDay($date [,$flag]);
Packit 95306a
Packit 95306a
 $date = Date_NextWorkDay($date,$off [,$flag]);
Packit 95306a
Packit 95306a
 $date = Date_PrevWorkDay($date,$off [,$flag]);
Packit 95306a
Packit 95306a
 $date = Date_NearestWorkDay($date [,$tomorrowfirst]);
Packit 95306a
Packit 95306a
The above routines all check to make sure that Date_Init is called.  If it
Packit 95306a
hasn't been, they will call it automatically.  As a result, there is usually
Packit 95306a
no need to call Date_Init explicitly unless you want to change some of the
Packit 95306a
config variables (described below).  They also do error checking on the
Packit 95306a
input.
Packit 95306a
Packit 95306a
The routines listed below are intended primarily for internal use by other
Packit 95306a
Date::Manip routines.  They do little or no error checking, and do not
Packit 95306a
explicitly call Date_Init.  Those functions are all done in the main
Packit 95306a
Date::Manip routines above.
Packit 95306a
Packit 95306a
Because they are significantly faster than the full Date::Manip routines,
Packit 95306a
they are available for use with a few caveats.  Since little or no
Packit 95306a
error checking is done, it is the responsibility of the programmer to
Packit 95306a
ensure that valid data (AND valid dates) are passed to them.  Passing
Packit 95306a
invalid data (such as a non-numeric month) or invalid dates (Feb 31)
Packit 95306a
will fail in unpredictable ways (possibly returning erroneous results).
Packit 95306a
Also, since Date_Init is not called by these, it must be called
Packit 95306a
explicitly by the programmer before using these routines.
Packit 95306a
Packit 95306a
In the following routines, $y may be entered as either a 2 or 4 digit year
Packit 95306a
(it will be converted to a 4 digit year based on the variable YYtoYYYY
Packit 95306a
described below).  Month and day should be numeric in all cases.  Most (if
Packit 95306a
not all) of the information below can be gotten from UnixDate which is
Packit 95306a
really the way I intended it to be gotten, but there are reasons to use
Packit 95306a
these (these are significantly faster).
Packit 95306a
Packit 95306a
 $day = Date_DayOfWeek($m,$d,$y);
Packit 95306a
 $secs = Date_SecsSince1970($m,$d,$y,$h,$mn,$s);
Packit 95306a
 $secs = Date_SecsSince1970GMT($m,$d,$y,$h,$mn,$s);
Packit 95306a
 $days = Date_DaysSince1BC($m,$d,$y);
Packit 95306a
 $day = Date_DayOfYear($m,$d,$y);
Packit 95306a
 ($y,$m,$d,$h,$mn,$s) = Date_NthDayOfYear($y,$n);
Packit 95306a
 $days = Date_DaysInYear($y);
Packit 95306a
 $days = Date_DaysInMonth($m,$y);
Packit 95306a
 $wkno = Date_WeekOfYear($m,$d,$y,$first);
Packit 95306a
 $flag = Date_LeapYear($y);
Packit 95306a
 $day = Date_DaySuffix($d);
Packit 95306a
 $tz = Date_TimeZone();
Packit 95306a
Packit 95306a
=head1 ROUTINES
Packit 95306a
Packit 95306a
=over 4
Packit 95306a
Packit 95306a
=item B<Date_Init>
Packit 95306a
Packit 95306a
 Date_Init();
Packit 95306a
 Date_Init("VAR=VAL","VAR=VAL",...);
Packit 95306a
 @list = Date_Init();
Packit 95306a
 @list = Date_Init("VAR=VAL","VAR=VAL",...);
Packit 95306a
Packit 95306a
Normally, it is not necessary to explicitly call Date_Init.  The first
Packit 95306a
time any of the other routines are called, Date_Init will be called to set
Packit 95306a
everything up.  If for some reason you want to change the configuration of
Packit 95306a
Date::Manip, you can pass the appropriate string or strings into Date_Init
Packit 95306a
to reinitialize things.
Packit 95306a
Packit 95306a
The strings to pass in are of the form "VAR=VAL".  Any number may be
Packit 95306a
included and they can come in any order.  VAR may be any configuration
Packit 95306a
variable.  A list of all configuration variables is given in the section
Packit 95306a
CUSTOMIZING DATE::MANIP below.  VAL is any allowed value for that variable.
Packit 95306a
For example, to switch from English to French and use non-US format (so
Packit 95306a
that 12/10 is Oct 12), do the following:
Packit 95306a
Packit 95306a
  Date_Init("Language=French","DateFormat=non-US");
Packit 95306a
Packit 95306a
If Date_Init is called in list context, it will return a list of all
Packit 95306a
config variables and their values suitable for passing in to Date_Init
Packit 95306a
to return Date::Manip to the current state.  The only possible problem is
Packit 95306a
that by default, holidays will not be erased, so you may need to prepend
Packit 95306a
the "EraseHolidays=1" element to the list.
Packit 95306a
Packit 95306a
=item B<ParseDate>
Packit 95306a
Packit 95306a
 $date = ParseDate(\@args);
Packit 95306a
 $date = ParseDate($string);
Packit 95306a
 $date = ParseDate(\$string);
Packit 95306a
Packit 95306a
This takes an array or a string containing a date and parses it.  When the
Packit 95306a
date is included as an array (for example, the arguments to a program) the
Packit 95306a
array should contain a valid date in the first one or more elements
Packit 95306a
(elements after a valid date are ignored).  Elements containing a valid
Packit 95306a
date are shifted from the array.  The largest possible number of elements
Packit 95306a
which can be correctly interpreted as a valid date are always used.  If a
Packit 95306a
string is entered rather than an array, that string is tested for a valid
Packit 95306a
date.  The string is unmodified, even if passed in by reference.
Packit 95306a
Packit 95306a
The real work is done in the ParseDateString routine.
Packit 95306a
Packit 95306a
The ParseDate routine is primarily used to handle command line arguments.
Packit 95306a
If you have a command where you want to enter a date as a command line
Packit 95306a
argument, you can use Date::Manip to make something like the following
Packit 95306a
work:
Packit 95306a
Packit 95306a
  mycommand -date Dec 10 1997 -arg -arg2
Packit 95306a
Packit 95306a
No more reading man pages to find out what date format is required in a
Packit 95306a
man page.
Packit 95306a
Packit 95306a
Historical note: this is originally why the Date::Manip routines were
Packit 95306a
written (though long before they were released as the Date::Manip module).
Packit 95306a
I was using a bunch of programs (primarily batch queue managers) where
Packit 95306a
dates and times were entered as command line options and I was getting
Packit 95306a
highly annoyed at the many different (but not compatible) ways that they
Packit 95306a
had to be entered.  Date::Manip originally consisted of basically 1 routine
Packit 95306a
which I could pass "@ARGV" to and have it remove a date from the beginning.
Packit 95306a
Packit 95306a
=item B<ParseDateString>
Packit 95306a
Packit 95306a
 $date = ParseDateString($string);
Packit 95306a
Packit 95306a
This routine is called by ParseDate, but it may also be called directly
Packit 95306a
to save some time (a negligible amount).
Packit 95306a
Packit 95306a
NOTE:  One of the most frequently asked questions that I have gotten
Packit 95306a
is how to parse seconds since the epoch.  ParseDateString cannot simply
Packit 95306a
parse a number as the seconds since the epoch (it conflicts with some
Packit 95306a
ISO-8601 date formats).  There are two ways to get this information.
Packit 95306a
First, you can do the following:
Packit 95306a
Packit 95306a
    $secs = ...         # seconds since Jan 1, 1970  00:00:00 GMT
Packit 95306a
    $date = DateCalc("Jan 1, 1970  00:00:00 GMT","+ $secs");
Packit 95306a
Packit 95306a
Second, you can call it directly as:
Packit 95306a
Packit 95306a
    $date = ParseDateString("epoch $secs");
Packit 95306a
Packit 95306a
To go backwards, just use the "%s" format of UnixDate:
Packit 95306a
Packit 95306a
    $secs = UnixDate($date,"%s");
Packit 95306a
Packit 95306a
A full date actually includes 2 parts: date and time.  A time must include
Packit 95306a
hours and minutes and can optionally include seconds, fractional seconds,
Packit 95306a
an am/pm type string, and a time zone.  For example:
Packit 95306a
Packit 95306a
     [at] HH:MN              [Zone]
Packit 95306a
     [at] HH:MN         [am] [Zone]
Packit 95306a
     [at] HH:MN:SS      [am] [Zone]
Packit 95306a
     [at] HH:MN:SS.SSSS [am] [Zone]
Packit 95306a
     [at] HH            am   [Zone]
Packit 95306a
Packit 95306a
Hours can be written using 1 or 2 digits, but the single digit form may
Packit 95306a
only be used when no ambiguity is introduced (i.e. when it is not
Packit 95306a
immediately preceded by a digit).
Packit 95306a
Packit 95306a
A time is usually entered in 24 hour mode, but 12 hour mode can be used
Packit 95306a
as well if AM/PM are entered (AM can be entered as AM or A.M. or other
Packit 95306a
variations depending on the language).
Packit 95306a
Packit 95306a
Fractional seconds are also supported in parsing but the fractional part is
Packit 95306a
discarded (with NO rounding occurring).
Packit 95306a
Packit 95306a
Time zones always appear immediately after the time.  A number of different
Packit 95306a
forms are supported (see the section TIME ZONES below).
Packit 95306a
Packit 95306a
Incidentally, the time is removed from the date before the date is parsed,
Packit 95306a
so the time may appear before or after the date, or between any two parts
Packit 95306a
of the date.
Packit 95306a
Packit 95306a
Valid date formats include the ISO 8601 formats:
Packit 95306a
Packit 95306a
   YYYYMMDDHHMNSSF...
Packit 95306a
   YYYYMMDDHHMNSS
Packit 95306a
   YYYYMMDDHHMN
Packit 95306a
   YYYYMMDDHH
Packit 95306a
   YY-MMDDHHMNSSF...
Packit 95306a
   YY-MMDDHHMNSS
Packit 95306a
   YY-MMDDHHMN
Packit 95306a
   YY-MMDDHH
Packit 95306a
   YYYYMMDD
Packit 95306a
   YYYYMM
Packit 95306a
   YYYY
Packit 95306a
   YY-MMDD
Packit 95306a
   YY-MM
Packit 95306a
   YY
Packit 95306a
   YYYYwWWD      ex.  1965-W02-2
Packit 95306a
   YYwWWD
Packit 95306a
   YYYYDOY       ex.  1965-045
Packit 95306a
   YYDOY
Packit 95306a
Packit 95306a
In the above list, YYYY and YY signify 4 or 2 digit years, MM, DD, HH, MN, SS
Packit 95306a
refer to two digit month, day, hour, minute, and second respectively.  F...
Packit 95306a
refers to fractional seconds (any number of digits) which will be ignored.
Packit 95306a
In all cases, the date and time parts may be separated by the letter "T"
Packit 95306a
(but this is optional), so
Packit 95306a
   2002-12-10-12:00:00
Packit 95306a
   2002-12-10T12:00:00
Packit 95306a
are identical.
Packit 95306a
Packit 95306a
The last 4 formats can be explained by example:  1965-w02-2 refers to Tuesday
Packit 95306a
(day 2) of the 2nd week of 1965.  1965-045 refers to the 45th day of 1965.
Packit 95306a
Packit 95306a
In all cases, parts of the date may be separated by dashes "-".  If this is
Packit 95306a
done, 1 or 2 digit forms of MM, DD, etc. may be used.  All dashes are
Packit 95306a
optional except for those given in the table above (which MUST be included
Packit 95306a
for that format to be correctly parsed).  So 19980820, 1998-0820,
Packit 95306a
1998-08-20, 1998-8-20, and 199808-20 are all equivalent, but that date may
Packit 95306a
NOT be written as 980820 (it must be written as 98-0820).
Packit 95306a
Packit 95306a
NOTE:  Even though not allowed in the standard, the time zone for an ISO-8601
Packit 95306a
date is flexible and may be any of the time zones understood by Date::Manip.
Packit 95306a
Packit 95306a
Additional date formats are available which may or may not be common including:
Packit 95306a
Packit 95306a
  MM/DD  **
Packit 95306a
  MM/DD/YY  **
Packit 95306a
  MM/DD/YYYY  **
Packit 95306a
Packit 95306a
  mmmDD       DDmmm                   mmmYYYY/DD     mmmYYYY
Packit 95306a
  mmmDD/YY    DDmmmYY     DD/YYmmm    YYYYmmmDD      YYYYmmm
Packit 95306a
  mmmDDYYYY   DDmmmYYYY   DDYYYYmmm   YYYY/DDmmm
Packit 95306a
Packit 95306a
Where mmm refers to the name of a month.  All parts of the date can be
Packit 95306a
separated by valid separators (space, "/", or ".").  The separator "-" may
Packit 95306a
be used as long as it doesn't conflict with an ISO 8601 format, but this
Packit 95306a
is discouraged since it is easy to overlook conflicts.  For example, the
Packit 95306a
format MM/DD/YY is just fine, but MM-DD-YY does not work since it conflicts
Packit 95306a
with YY-MM-DD.  To be safe, if "-" is used as a separator in a non-ISO
Packit 95306a
format, they should be turned into "/" before calling the Date::Manip
Packit 95306a
routines.  As with ISO 8601 formats, all separators are optional except for
Packit 95306a
those given as a "/" in the list above.
Packit 95306a
Packit 95306a
** Note that with these formats, Americans tend to write month first, but
Packit 95306a
many other countries tend to write day first.  The latter behavior can be
Packit 95306a
obtained by setting the config variable DateFormat to something other than
Packit 95306a
"US" (see CUSTOMIZING DATE::MANIP below).
Packit 95306a
Packit 95306a
Date separators are treated very flexibly (they are converted to spaces),
Packit 95306a
so the following dates are all equivalent:
Packit 95306a
Packit 95306a
   12/10/1965
Packit 95306a
   12-10 / 1965
Packit 95306a
   12 // 10 -. 1965
Packit 95306a
Packit 95306a
In some cases, this may actually be TOO flexible, but no attempt is made to
Packit 95306a
trap this.
Packit 95306a
Packit 95306a
Years can be entered as 2 or 4 digits, days and months as 1 or 2 digits.
Packit 95306a
Both days and months must include 2 digits whenever they are immediately
Packit 95306a
adjacent to another numeric part of the date or time.  Date separators
Packit 95306a
are required if single digit forms of DD or MM are used.  If separators
Packit 95306a
are not used, the date will either be unparsable or will get parsed
Packit 95306a
incorrectly.
Packit 95306a
Packit 95306a
Miscellaneous other allowed formats are:
Packit 95306a
  which dofw in mmm in YY      "first Sunday in June
Packit 95306a
                               1996 at 14:00" **
Packit 95306a
  dofw week num YY             "Sunday week 22 1995" **
Packit 95306a
  which dofw YY                "22nd Sunday at noon" **
Packit 95306a
  dofw which week YY           "Sunday 22nd week in
Packit 95306a
                               1996" **
Packit 95306a
  next/last dofw               "next Friday at noon"
Packit 95306a
  next/last week/month         "next month"
Packit 95306a
  in num days/weeks/months     "in 3 weeks at 12:00"
Packit 95306a
  num days/weeks/months later  "3 weeks later"
Packit 95306a
  num days/weeks/months ago    "3 weeks ago"
Packit 95306a
  dofw in num week             "Friday in 2 weeks"
Packit 95306a
  in num weeks dofw            "in 2 weeks on Friday"
Packit 95306a
  dofw num week ago            "Friday 2 weeks ago"
Packit 95306a
  num week ago dofw            "2 weeks ago Friday"
Packit 95306a
  last day in mmm in YY        "last day of October"
Packit 95306a
  dofw                         "Friday" (Friday of
Packit 95306a
                               current week)
Packit 95306a
  Nth                          "12th", "1st" (day of
Packit 95306a
                               current month)
Packit 95306a
  epoch SECS                   seconds since the epoch
Packit 95306a
                               (negative values are
Packit 95306a
                               supported)
Packit 95306a
Packit 95306a
** Note that the formats "Sunday week 22" and "22nd Sunday" give very
Packit 95306a
different behaviors.  "Sunday week 22" returns the Sunday of the 22nd week
Packit 95306a
of the year based on how week 1 is defined.  ISO 8601 defines week one to
Packit 95306a
contain Jan 4, so "Sunday week 1" might be the first or second Sunday of
Packit 95306a
the current year, or the last Sunday of the previous year.  "22nd Sunday"
Packit 95306a
gives the actual 22nd time Sunday occurs in a given year, regardless of the
Packit 95306a
definition of a week.
Packit 95306a
Packit 95306a
Note that certain words such as "in", "at", "of", etc. which commonly appear
Packit 95306a
in a date or time are ignored.  Also, the year is always optional.
Packit 95306a
Packit 95306a
In addition, the following strings are recognized:
Packit 95306a
  today     (exactly now OR today at a given time if a time is specified)
Packit 95306a
  now       (synonym for today)
Packit 95306a
  yesterday (exactly 24 hours ago unless a time is specified)
Packit 95306a
  tomorrow  (exactly 24 hours from now unless a time is specified)
Packit 95306a
  noon      (12:00:00)
Packit 95306a
  midnight  (00:00:00)
Packit 95306a
Other languages have similar (and in some cases additional) strings.
Packit 95306a
Packit 95306a
Some things to note:
Packit 95306a
Packit 95306a
All strings are case insensitive.  "December" and "DEceMBer" both work.
Packit 95306a
Packit 95306a
When a part of the date is not given, defaults are used: year defaults
Packit 95306a
to current year; hours, minutes, seconds to 00.
Packit 95306a
Packit 95306a
The year may be entered as 2 or 4 digits.  If entered as 2 digits, it will
Packit 95306a
be converted to a 4 digit year.  There are several ways to do this based on
Packit 95306a
the value of the YYtoYYYY variable (described below).  The default behavior
Packit 95306a
it to force the 2 digit year to be in the 100 year period CurrYear-89 to
Packit 95306a
CurrYear+10.  So in 1996, the range is [1907 to 2006], and the 2 digit year
Packit 95306a
05 would refer to 2005 but 07 would refer to 1907.  See CUSTOMIZING
Packit 95306a
DATE::MANIP below for information on YYtoYYYY for other methods.
Packit 95306a
Packit 95306a
Dates are always checked to make sure they are valid.
Packit 95306a
Packit 95306a
In all of the formats, the day of week ("Friday") can be entered anywhere
Packit 95306a
in the date and it will be checked for accuracy.  In other words,
Packit 95306a
  "Tue Jul 16 1996 13:17:00"
Packit 95306a
will work but
Packit 95306a
  "Jul 16 1996 Wednesday 13:17:00"
Packit 95306a
will not (because Jul 16, 1996 is Tuesday, not Wednesday).  Note that
Packit 95306a
depending on where the weekday comes, it may give unexpected results when
Packit 95306a
used in array context (with ParseDate).  For example, the date
Packit 95306a
("Jun","25","Sun","1990") would return June 25 of the current year since
Packit 95306a
Jun 25, 1990 is not Sunday.
Packit 95306a
Packit 95306a
The times "12:00 am", "12:00 pm", and "midnight" are not well defined.  For
Packit 95306a
good or bad, I use the following convention in Date::Manip:
Packit 95306a
  midnight = 12:00am = 00:00:00
Packit 95306a
  noon     = 12:00pm = 12:00:00
Packit 95306a
and the day goes from 00:00:00 to 23:59:59.  In other words, midnight is the
Packit 95306a
beginning of a day rather than the end of one.  The time 24:00:00 is also
Packit 95306a
allowed (though it is automatically transformed to 00:00:00 of the following
Packit 95306a
day).
Packit 95306a
Packit 95306a
The format of the date returned is YYYYMMDDHH:MM:SS.  The advantage of this
Packit 95306a
time format is that two times can be compared using simple string comparisons
Packit 95306a
to find out which is later.  Also, it is readily understood by a human.
Packit 95306a
Alternate forms can be used if that is more convenient.  See Date_Init below
Packit 95306a
and the config variable Internal.
Packit 95306a
Packit 95306a
NOTE: The format for the date is going to change at some point in the future
Packit 95306a
to YYYYMMDDHH:MN:SS+HHMN*FLAGS.  In order to maintain compatibility, you
Packit 95306a
should use UnixDate to extract information from a date, and Date_Cmp to compare
Packit 95306a
two dates.  The simple string comparison will only work for dates in the same
Packit 95306a
time zone.
Packit 95306a
Packit 95306a
=item B<UnixDate>
Packit 95306a
Packit 95306a
 @date = UnixDate($date,@format);
Packit 95306a
 $date = UnixDate($date,@format);
Packit 95306a
Packit 95306a
This takes a date and a list of strings containing formats roughly
Packit 95306a
identical to the format strings used by the UNIX date(1) command.  Each
Packit 95306a
format is parsed and an array of strings corresponding to each format is
Packit 95306a
returned.
Packit 95306a
Packit 95306a
$date may be any string that can be parsed by ParseDateString.
Packit 95306a
Packit 95306a
The format options are:
Packit 95306a
Packit 95306a
 Year
Packit 95306a
     %y     year                     - 00 to 99
Packit 95306a
     %Y     year                     - 0001 to 9999
Packit 95306a
 Month, Week
Packit 95306a
     %m     month of year            - 01 to 12
Packit 95306a
     %f     month of year            - " 1" to "12"
Packit 95306a
     %b,%h  month abbreviation       - Jan to Dec
Packit 95306a
     %B     month name               - January to December
Packit 95306a
 Day
Packit 95306a
     %j     day of the year          - 001 to 366
Packit 95306a
     %d     day of month             - 01 to 31
Packit 95306a
Packit 95306a
     %e     day of month             - " 1" to "31"
Packit 95306a
     %v     weekday abbreviation     - " S"," M"," T"," W","Th"," F","Sa"
Packit 95306a
     %a     weekday abbreviation     - Sun to Sat
Packit 95306a
     %A     weekday name             - Sunday to Saturday
Packit 95306a
     %w     day of week              - 1 (Monday) to 7 (Sunday)
Packit 95306a
     %E     day of month with suffix - 1st, 2nd, 3rd...
Packit 95306a
 Hour
Packit 95306a
     %H     hour                     - 00 to 23
Packit 95306a
     %k     hour                     - " 0" to "23"
Packit 95306a
     %i     hour                     - " 1" to "12"
Packit 95306a
     %I     hour                     - 01 to 12
Packit 95306a
     %p     AM or PM
Packit 95306a
 Minute, Second, Time zone
Packit 95306a
     %M     minute                   - 00 to 59
Packit 95306a
     %S     second                   - 00 to 59
Packit 95306a
     %Z     time zone                - "EDT"
Packit 95306a
     %z     time zone as GMT offset  - "+0100"
Packit 95306a
 Epoch (see NOTE 3 below)
Packit 95306a
     %s     seconds from 1/1/1970 GMT- negative if before 1/1/1970
Packit 95306a
     %o     seconds from Jan 1, 1970
Packit 95306a
            in the current time zone
Packit 95306a
 Date, Time
Packit 95306a
     %c     %a %b %e %H:%M:%S %Y     - Fri Apr 28 17:23:15 1995
Packit 95306a
     %C,%u  %a %b %e %H:%M:%S %z %Y  - Fri Apr 28 17:25:57 EDT 1995
Packit 95306a
     %g     %a, %d %b %Y %H:%M:%S %z - Fri, 28 Apr 1995 17:23:15 EDT
Packit 95306a
     %D     %m/%d/%y                 - 04/28/95
Packit 95306a
     %x     %m/%d/%y or %d/%m/%y     - 04/28/95 or 28/04/28
Packit 95306a
                                       (Depends on DateFormat variable)
Packit 95306a
     %l     date in ls(1) format (see NOTE 1 below)
Packit 95306a
              %b %e $H:$M            - Apr 28 17:23  (if within 6 months)
Packit 95306a
              %b %e  %Y              - Apr 28  1993  (otherwise)
Packit 95306a
     %r     %I:%M:%S %p              - 05:39:55 PM
Packit 95306a
     %R     %H:%M                    - 17:40
Packit 95306a
     %T,%X  %H:%M:%S                 - 17:40:58
Packit 95306a
     %V     %m%d%H%M%y               - 0428174095
Packit 95306a
     %Q     %Y%m%d                   - 19961025
Packit 95306a
     %q     %Y%m%d%H%M%S             - 19961025174058
Packit 95306a
     %P     %Y%m%d%H%M%S             - 1996102517:40:58
Packit 95306a
     %O     %Y-%m-%dT%H:%M:%S        - 1996-10-25T17:40:58
Packit 95306a
     %F     %A, %B %e, %Y            - Sunday, January  1, 1996
Packit 95306a
     %K     %Y-%j                    - 1997-045
Packit 95306a
 Special Year/Week formats (see NOTE 2 below)
Packit 95306a
     %G     year, Monday as first
Packit 95306a
            day of week              - 0001 to 9999
Packit 95306a
     %W     week of year, Monday
Packit 95306a
            as first day of week     - 01 to 53
Packit 95306a
     %L     year, Sunday as first
Packit 95306a
            day of week              - 0001 to 9999
Packit 95306a
     %U     week of year, Sunday
Packit 95306a
            as first day of week     - 01 to 53
Packit 95306a
     %J     %G-W%W-%w                - 1997-W02-2
Packit 95306a
 Other formats
Packit 95306a
     %n     insert a newline character
Packit 95306a
     %t     insert a tab character
Packit 95306a
     %%     insert a `%' character
Packit 95306a
     %+     insert a `+' character
Packit 95306a
 The following formats are currently unused but may be used in the future:
Packit 95306a
     N 1234567890 !@#$^&*()_|-=\`[];',./~{}:<>?
Packit 95306a
 They currently insert the character following the %, but may (and probably
Packit 95306a
 will) change in the future as new formats are added.
Packit 95306a
Packit 95306a
If a lone percent is the final character in a format, it is ignored.
Packit 95306a
Packit 95306a
The formats used in this routine were originally based on date.pl (version
Packit 95306a
3.2) by Terry McGonigal, as well as a couple taken from different versions
Packit 95306a
of the Solaris date(1) command.  Also, several have been added which are
Packit 95306a
unique to Date::Manip.
Packit 95306a
Packit 95306a
NOTE 1:
Packit 95306a
Packit 95306a
The ls format (%l) applies to date within the past OR future 6 months!
Packit 95306a
Packit 95306a
NOTE 2:
Packit 95306a
Packit 95306a
The %U, %W, %L, %G, and %J formats are used to support the ISO-8601 format:
Packit 95306a
YYYY-wWW-D.  In this format, a date is written as a year, the week of the
Packit 95306a
year, and the day of the week.  Technically, the week may be considered to
Packit 95306a
start on any day of the week, but Sunday and Monday are the both common
Packit 95306a
choices, so both are supported.
Packit 95306a
Packit 95306a
The %W and %G formats return the week-of-year and the year treating weeks
Packit 95306a
as starting on Monday.
Packit 95306a
Packit 95306a
The %U and %L formats return the week-of-year and the year treating weeks
Packit 95306a
as starting on Sunday.
Packit 95306a
Packit 95306a
Most of the time, the %L and %G formats returns the same value as the %Y
Packit 95306a
format, but there is a problem with days occurring in the first or last week
Packit 95306a
of the year.
Packit 95306a
Packit 95306a
The ISO-8601 representation of Jan 1, 1993 written in the YYYY-wWW-D format
Packit 95306a
is actually 1992-W53-5.  In other words, Jan 1 is treated as being in the
Packit 95306a
last week of the preceding year.  Depending on the year, days in the first
Packit 95306a
week of a year may belong to the previous year, and days in the final week
Packit 95306a
of a year may belong to the next year.  The week is assigned to the year
Packit 95306a
which has most of the days.  For example, if the week starts on Sunday,
Packit 95306a
then the last week of 2003 is 2003-12-28 to 2004-01-03.  This week is
Packit 95306a
assigned to 2003 since 4 of the days in it are in 2003 and only 3 of them
Packit 95306a
are in 2004.  The first week of 2004 starts on 2004-01-04.
Packit 95306a
Packit 95306a
The %U and %W formats return a week-of-year number from 01 to 53. %L and
Packit 95306a
%G return the corresponding year, and to get this type of information,
Packit 95306a
you should always use the (%W,%G) combination or (%U,%L) combination. %Y
Packit 95306a
should not be used as it will yield incorrect results.
Packit 95306a
Packit 95306a
%J returns the full ISO-8601 format (%G-W%W-%w).
Packit 95306a
Packit 95306a
NOTE 3:
Packit 95306a
Packit 95306a
The %s and %o formats return negative values if the date is before
Packit 95306a
the start of the epoch.  Other Unix utilities would return an error, or
Packit 95306a
a zero, so if you are going to use Date::Manip in conjunction with these,
Packit 95306a
be sure to check for a negative value.
Packit 95306a
Packit 95306a
=item B<ParseDateDelta>
Packit 95306a
Packit 95306a
 $delta = ParseDateDelta(\@args);
Packit 95306a
 $delta = ParseDateDelta($string);
Packit 95306a
 $delta = ParseDateDelta(\$string);
Packit 95306a
Packit 95306a
This takes an array and shifts a valid delta date (an amount of time)
Packit 95306a
from the array.  Recognized deltas are of the form:
Packit 95306a
  +Yy +Mm +Ww +Dd +Hh +MNmn +Ss
Packit 95306a
      examples:
Packit 95306a
         +4 hours +3mn -2second
Packit 95306a
         + 4 hr 3 minutes -2
Packit 95306a
         4 hour + 3 min -2 s
Packit 95306a
  +Y:+M:+W:+D:+H:+MN:+S
Packit 95306a
      examples:
Packit 95306a
         0:0:0:0:4:3:-2
Packit 95306a
         +4:3:-2
Packit 95306a
  mixed format
Packit 95306a
      examples:
Packit 95306a
         4 hour 3:-2
Packit 95306a
Packit 95306a
A field in the format +Yy is a sign, a number, and a string specifying
Packit 95306a
the type of field.  The sign is "+", "-", or absent (defaults to the
Packit 95306a
next larger element).  The valid strings specifying the field type
Packit 95306a
are:
Packit 95306a
   y:  y, yr, year, years
Packit 95306a
   m:  m, mon, month, months
Packit 95306a
   w:  w, wk, ws, wks, week, weeks
Packit 95306a
   d:  d, day, days
Packit 95306a
   h:  h, hr, hour, hours
Packit 95306a
   mn: mn, min, minute, minutes
Packit 95306a
   s:  s, sec, second, seconds
Packit 95306a
Packit 95306a
Also, the "s" string may be omitted.  The sign, number, and string may
Packit 95306a
all be separated from each other by any number of whitespace.
Packit 95306a
Packit 95306a
In the date, all fields must be given in the order: Y M W D H MN S.  Any
Packit 95306a
number of them may be omitted provided the rest remain in the correct
Packit 95306a
order.  In the 2nd (colon) format, from 2 to 7 of the fields may be given.
Packit 95306a
For example +D:+H:+MN:+S may be given to specify only four of the fields.
Packit 95306a
In any case, both the MN and S field may be present.  No spaces may be
Packit 95306a
present in the colon format.
Packit 95306a
Packit 95306a
Deltas may also be given as a combination of the two formats.  For example,
Packit 95306a
the following is valid: +Yy +D:+H:+MN:+S.  Again, all fields must be given
Packit 95306a
in the correct order.
Packit 95306a
Packit 95306a
The word "in" may be given (prepended in English) to the delta ("in 5 years")
Packit 95306a
and the word "ago" may be given (appended in English) ("6 months ago").  The
Packit 95306a
"in" is completely ignored.  The "ago" has the affect of reversing all signs
Packit 95306a
that appear in front of the components of the delta.  I.e. "-12 yr 6 mon ago"
Packit 95306a
is identical to "+12yr +6mon" (don't forget that there is an implied minus
Packit 95306a
sign in front of the 6 because when no sign is explicitly given, it carries
Packit 95306a
the previously entered sign).
Packit 95306a
Packit 95306a
One thing is worth noting.  The year/month and day/hour/min/sec parts are
Packit 95306a
returned in a "normalized" form.  That is, the signs are adjusted so as to
Packit 95306a
be all positive or all negative.  For example, "+ 2 day - 2hour" does not
Packit 95306a
return "0:0:0:2:-2:0:0".  It returns "+0:0:0:1:22:0:0" (1 day 22 hours
Packit 95306a
which is equivalent).  I find (and I think most others agree) that this is
Packit 95306a
a more useful form.
Packit 95306a
Packit 95306a
Since the year/month and day/hour/min/sec parts must be normalized
Packit 95306a
separately there is the possibility that the sign of the two parts will be
Packit 95306a
different.  So, the delta "+ 2years -10 months - 2 days + 2 hours" produces
Packit 95306a
the delta "+1:2:-0:1:22:0:0".
Packit 95306a
Packit 95306a
It is possible to include a sign for all elements that is output.  See the
Packit 95306a
configuration variable DeltaSigns below.
Packit 95306a
Packit 95306a
NOTE: The internal format of the delta changed in version 5.30 from
Packit 95306a
Y:M:D:H:MN:S to Y:M:W:D:H:MN:S .  Also, it is going to change again at some
Packit 95306a
point in the future to Y:M:W:D:H:MN:S*FLAGS .  Use the routine Delta_Format
Packit 95306a
to extract information rather than parsing it yourself.
Packit 95306a
Packit 95306a
=item B<Delta_Format>
Packit 95306a
Packit 95306a
 @str = Delta_Format($delta [,$mode], $dec,@format);
Packit 95306a
 $str = Delta_Format($delta [,$mode], $dec,@format);
Packit 95306a
Packit 95306a
This is similar to the UnixDate routine except that it extracts information
Packit 95306a
from a delta.  Unlike the UnixDate routine, most of the formats are 2
Packit 95306a
characters instead of 1.
Packit 95306a
Packit 95306a
Formats currently understood are:
Packit 95306a
Packit 95306a
   %Xv     : the value of the field named X
Packit 95306a
   %Xd     : the value of the field X, and all smaller fields, expressed in
Packit 95306a
             units of X
Packit 95306a
   %Xh     : the value of field X, and all larger fields, expressed in units
Packit 95306a
             of X
Packit 95306a
   %Xt     : the value of all fields expressed in units of X
Packit 95306a
Packit 95306a
   X is one of y,M,w,d,h,m,s (case sensitive).
Packit 95306a
Packit 95306a
   %%      : returns a "%"
Packit 95306a
Packit 95306a
So, the format "%hd" means the values of H, MN, and S expressed in hours.
Packit 95306a
So for the delta "0:0:0:0:2:30:0", this format returns 2.5.
Packit 95306a
Packit 95306a
Delta_Format can operate in two modes: exact and approximate. The exact
Packit 95306a
mode is done by default. Approximate mode can be done by passing in
Packit 95306a
the string "approx" as the 2nd argument.
Packit 95306a
Packit 95306a
In exact mode, Delta_Format only understands "exact" relationships. This
Packit 95306a
means that there can be no mixing of the Y/M and W/D/H/MN/S segments
Packit 95306a
because the relationship because, depending on when the delta occurs, there
Packit 95306a
is no exact relation between the number of years or months and the number
Packit 95306a
of days.
Packit 95306a
Packit 95306a
The two sections are treated completely separate from each other. So,
Packit 95306a
the delta "1:6:1:2:12:0:0" would return the following values:
Packit 95306a
Packit 95306a
  %yt = 1.5 (1 year, 6 months)
Packit 95306a
  %Mt = 18
Packit 95306a
Packit 95306a
  %dt = 9.5 (1 week, 2 days, 12 hours)
Packit 95306a
Packit 95306a
In approximate mode, the relationship of 1 year = 365.25 days is applied
Packit 95306a
(with 1 month equal to 1/12 of a year exactly). So the delta
Packit 95306a
"1:6:1:2:12:0:0" would return the following values:
Packit 95306a
Packit 95306a
  %dt = 557.375 (1.5 years of 365.25 days + 9.5 days)
Packit 95306a
Packit 95306a
If $dec is non-zero, the %Xd and %Xt values are formatted to contain $dec
Packit 95306a
decimal places.
Packit 95306a
Packit 95306a
=item B<ParseRecur>
Packit 95306a
Packit 95306a
 $recur = ParseRecur($string [,$base,$date0,$date1,$flags]);
Packit 95306a
 @dates = ParseRecur($string [,$base,$date0,$date1,$flags]);
Packit 95306a
Packit 95306a
A recurrence refers to a recurring event, and more specifically, an event
Packit 95306a
which occurs on a regular basis.  A fully specified recurring event
Packit 95306a
may requires up to four pieces of information.
Packit 95306a
Packit 95306a
First, it requires a description of the frequency of the event.  Examples
Packit 95306a
include "the first of every month", "every other day", "the 4th
Packit 95306a
Thursday of each month at 2:00 PM", and "every 2 hours and 30 minutes".
Packit 95306a
Packit 95306a
Second, it may require a base date to work from.  This piece of information
Packit 95306a
is not required for every type of recurrence.  For example, if the
Packit 95306a
frequency is "the first of every month", no base date is required.  All the
Packit 95306a
information about when the event occurs is included in the frequency
Packit 95306a
description.  If the frequency were "every other day" though, you need to
Packit 95306a
know at least one day on which the event occurred.
Packit 95306a
Packit 95306a
Third, the recurring event may have a range (a starting and ending date).
Packit 95306a
Packit 95306a
Fourth, there may be some flags included which modify the behavior of the
Packit 95306a
above information.
Packit 95306a
Packit 95306a
The fully specified recurrence is written as these 5 pieces of information
Packit 95306a
(both a start and end date) as an asterisk separated list:
Packit 95306a
Packit 95306a
  freq*flags*base*date0*date1
Packit 95306a
Packit 95306a
Here, base, date0, and date1 are any strings (which must not contain any
Packit 95306a
asterisks) which can be parsed by ParseDate.  flags is a comma separated
Packit 95306a
list of flags (described below), and freq is a string describing the
Packit 95306a
frequency of the recurring event.
Packit 95306a
Packit 95306a
The syntax of the frequency description is a colon separated list of the
Packit 95306a
format Y:M:W:D:H:MN:S (which stand for year, month, week, etc.).  One (and
Packit 95306a
only one) of the colons may optionally be replaced by an asterisk, or an
Packit 95306a
asterisk may be prepended to the string.  For example, the following are
Packit 95306a
all valid frequency descriptions:
Packit 95306a
Packit 95306a
  1:2:3:4:5:6:7
Packit 95306a
  1:2*3:4:5:6:7
Packit 95306a
 *1:2:3:4:5:6:7
Packit 95306a
Packit 95306a
But the following are NOT valid because they contain 2 or more asterisks:
Packit 95306a
Packit 95306a
  1:2*3:4:5*6:7
Packit 95306a
  1*2*3:4:5*6:7
Packit 95306a
 *1:2:3:4:5:6*7
Packit 95306a
Packit 95306a
If an asterisk is included, values to the left of it refer to the number of
Packit 95306a
times that time interval occurs between recurring events.  For example,
Packit 95306a
if the first part of the recurrence is:
Packit 95306a
Packit 95306a
  1:2*
Packit 95306a
Packit 95306a
this says that the recurring event occurs approximately every 1 year and 2
Packit 95306a
months.  I say approximately, because elements to the right of the asterisk,
Packit 95306a
as well as any flags included in the recurrence will affect when the actual
Packit 95306a
events occur.
Packit 95306a
Packit 95306a
If no asterisks are included, then the entire recurrence is of this form.
Packit 95306a
For example,
Packit 95306a
Packit 95306a
  0:0:0:1:12:0:0
Packit 95306a
Packit 95306a
refers to an event that occurs every 1 day, 12 hours.
Packit 95306a
Packit 95306a
Values that occur after an asterisk refer to a specific value for that type
Packit 95306a
of time element (i.e. exactly as it would appear on a calendar or a clock).
Packit 95306a
For example, if the recurrence ends with:
Packit 95306a
Packit 95306a
  *12:0:0
Packit 95306a
Packit 95306a
then the recurring event occurs at 12:00:00 (noon).
Packit 95306a
Packit 95306a
For example:
Packit 95306a
Packit 95306a
  0:0:2:1:0:0:0        every 2 weeks and 1 day
Packit 95306a
  0:0:0:0:5:30:0       every 5 hours and 30 minutes
Packit 95306a
  0:0:0:2*12:30:0      every 2 days at 12:30 (each day)
Packit 95306a
Packit 95306a
Values to the right of the asterisk can be listed a single values, ranges
Packit 95306a
(2 numbers separated by a dash "-"), or a comma separated list of values
Packit 95306a
or ranges.  In most cases, negative values are appropriate for the week
Packit 95306a
or day values. -1 stands for the last possible value, -2 for the second
Packit 95306a
to the last, etc.
Packit 95306a
Packit 95306a
Some examples are:
Packit 95306a
Packit 95306a
  0:0:0:1*2,4,6:0:0    every day at at 2:00, 4:00, and 6:00
Packit 95306a
  0:0:0:2*12-13:0,30:0 every other day at 12:00, 12:30, 13:00,
Packit 95306a
                       and 13:30
Packit 95306a
  0:1:0*-1:0:0:0       the last day of every month
Packit 95306a
  *1990-1995:12:0:1:0:0:0
Packit 95306a
                       Dec 1 in 1990 through 1995
Packit 95306a
Packit 95306a
There is no way to express the following with a single recurrence:
Packit 95306a
Packit 95306a
  every day at 12:30 and 1:00
Packit 95306a
Packit 95306a
You have to use two recurrences to do this.
Packit 95306a
Packit 95306a
When a non-zero day element occurs to the right of the asterisk, it can take
Packit 95306a
on multiple meanings, depending on the value of the month and week
Packit 95306a
elements.  It can refer to the day of the week, day of the month, or day of
Packit 95306a
the year.  Similarly, if a non-zero week element occurs to the right of
Packit 95306a
the asterisk, it actually refers to the nth time a certain day of the week
Packit 95306a
occurs, either in the month or in the year.
Packit 95306a
Packit 95306a
If the week element is non-zero and the day element is non-zero (and to the
Packit 95306a
right of the asterisk), the day element refers to the day of the week. It
Packit 95306a
can be any value from 1 to 7 (negative values -1 to -7 are also
Packit 95306a
allowed). If you use the ISO 8601 convention, the first day of the week is
Packit 95306a
Monday (though Date::Manip can use any day as the start of the week by
Packit 95306a
setting the FirstDay config variable).  So, assuming that you are using the
Packit 95306a
ISO 8601 convention, the following examples illustrate day-of-week
Packit 95306a
recurrences:
Packit 95306a
Packit 95306a
  0:1*4:2:0:0:0        4th Tuesday (day 2) of every month
Packit 95306a
  0:1*-1:2:0:0:0       last Tuesday of every month
Packit 95306a
  0:0:3*2:0:0:0        every 3rd Tuesday (every 3 weeks
Packit 95306a
                       on 2nd day of week)
Packit 95306a
  1:0*12:2:0:0:0       the 12th Tuesday of each year
Packit 95306a
Packit 95306a
If the week element is non-zero, and the day element is zero, the day
Packit 95306a
defaults to 1 (i.e. the first day of the week).
Packit 95306a
Packit 95306a
  0:1*2:0:0:0:0        the 2nd occurrence of FirstDay
Packit 95306a
                       in the year (typically Monday)
Packit 95306a
  0:1*2:1:0:0:0        the same
Packit 95306a
Packit 95306a
If the week element is zero and the month element is non-zero, the day
Packit 95306a
value is the day of the month (it can be from 1 to 31 or -1 to -31 counting
Packit 95306a
from the end of the month). If a value of 0 is given, it defaults to 1.
Packit 95306a
Packit 95306a
  3*1:0:2:12:0:0       every 3 years on Jan 2 at noon
Packit 95306a
  0:1*0:2:12,14:0:0    2nd of every month at 12:00 and 14:00
Packit 95306a
  0:1:0*-2:0:0:0       2nd to last day of every month
Packit 95306a
Packit 95306a
If the day given refers to the 29th, 30th, or 31st, in a month
Packit 95306a
that does not have that number of days, it is ignored. For example,
Packit 95306a
if you ask for the 31st of every month, it will return dates in Jan,
Packit 95306a
Mar, May, Jul, etc.  Months with fewer than 31 days will be ignored.
Packit 95306a
Packit 95306a
If both the month and week elements are zero, and the year element
Packit 95306a
is non-zero, the day value is the day of the year (1 to 365 or 366 -- or
Packit 95306a
the negative numbers to count backwards from the end of the year).
Packit 95306a
Packit 95306a
  1:0:0*45:0:0:0       45th day of every year
Packit 95306a
Packit 95306a
Specifying a day that doesn't occur in that year silently ignores that
Packit 95306a
year. The only result of this is that specifying +366 or -366 will ignore
Packit 95306a
all years except leap years.
Packit 95306a
Packit 95306a
I realize that this looks a bit cryptic, but after a discussion on the
Packit 95306a
CALENDAR mailing list, it appeared like there was no concise, flexible
Packit 95306a
notation for handling recurring events.  ISO 8601 notations were very bulky
Packit 95306a
and lacked the flexibility I wanted.  As a result, I developed this
Packit 95306a
notation (based on crontab formats, but with much more flexibility) which
Packit 95306a
fits in well with this module. Even better, it is able to express every
Packit 95306a
type of recurring event I could think of that is used in common life in
Packit 95306a
(what I believe to be) a very concise and elegant way.
Packit 95306a
Packit 95306a
If ParseRecur is called in scalar context, it returns a string containing a
Packit 95306a
fully specified recurrence (or as much of it as can be determined with
Packit 95306a
unspecified fields left blank).  In list context, it returns a list of all
Packit 95306a
dates referred to by a recurrence if enough information is given in the
Packit 95306a
recurrence.  All dates returned are in the range:
Packit 95306a
Packit 95306a
  date0 <= date < date1
Packit 95306a
Packit 95306a
The argument $string can contain any of the parts of a full recurrence.
Packit 95306a
For example:
Packit 95306a
Packit 95306a
  freq
Packit 95306a
  freq*flags
Packit 95306a
  freq**base*date0*date1
Packit 95306a
Packit 95306a
The only part which is required is the frequency description.  Any values
Packit 95306a
contained in $string are overridden or modified by values passed in as
Packit 95306a
parameters to ParseRecur.
Packit 95306a
Packit 95306a
NOTE: If a recurrence has a date0 and date1 in it AND a date0 and date1
Packit 95306a
are passed in to the function, both sets of criteria apply.  If flags are
Packit 95306a
passed in, they override any flags in the recurrence UNLESS the flags
Packit 95306a
passed in start with a plus (+) character in which case they are appended
Packit 95306a
to the flags in the recurrence.
Packit 95306a
Packit 95306a
NOTE: Base dates are only used with some types of recurrences.  For example,
Packit 95306a
Packit 95306a
  0:0:3*2:0:0:0        every 3rd Tuesday
Packit 95306a
Packit 95306a
requires a base date.  If a base date is specified which doesn't match the
Packit 95306a
criteria (for example, if a base date falling on Monday were passed in with
Packit 95306a
this recurrence), the base date is moved forward to the first relevant date.
Packit 95306a
Packit 95306a
Other dates do not require a base date.  For example:
Packit 95306a
Packit 95306a
  0:0*3:2:0:0:0        third Tuesday of every month
Packit 95306a
Packit 95306a
A recurrence written in the above format does NOT provide default values
Packit 95306a
for base, date0, or date1.  They must be specified in order to get a list
Packit 95306a
of dates.
Packit 95306a
Packit 95306a
A base date is not used entirely.  It is only used to provide the parts
Packit 95306a
necessary for the left part of a recurrence.  For example, the recurrence:
Packit 95306a
Packit 95306a
  1:3*0:4:0:0:0        every 1 year, 3 months on the 4th day of the month
Packit 95306a
Packit 95306a
would only use the year and month of the base date.
Packit 95306a
Packit 95306a
There are a small handful of English strings which can be parsed in place
Packit 95306a
of a numerical recur description.  These include:
Packit 95306a
Packit 95306a
  every 2nd day [in 1997]
Packit 95306a
  every 2nd day in June [1997]
Packit 95306a
  2nd day of every month [in 1997]
Packit 95306a
  2nd Tuesday of every month [in 1997]
Packit 95306a
  last Tuesday of every month [in 1997]
Packit 95306a
  every Tuesday [in 1997]
Packit 95306a
  every 2nd Tuesday [in 1997]
Packit 95306a
  every 2nd Tuesday in June [1997]
Packit 95306a
Packit 95306a
Each of these set base, date0, and date1 to a default value (the current
Packit 95306a
year with Jan 1 being the base date is the default if the year and month
Packit 95306a
are missing).
Packit 95306a
Packit 95306a
The following flags (case insensitive) are understood:
Packit 95306a
Packit 95306a
  PDn   : n is 1-7.  Means the previous day n not counting today
Packit 95306a
  PTn   : n is 1-7.  Means the previous day n counting today
Packit 95306a
  NDn   : n is 1-7.  Means the next day n not counting today
Packit 95306a
  NTn   : n is 1-7.  Means the next day n counting today
Packit 95306a
Packit 95306a
  FDn   : n is any number.  Means step forward n days.
Packit 95306a
  BDn   : n is any number.  Means step backward n days.
Packit 95306a
  FWn   : n is any number.  Means step forward n workdays.
Packit 95306a
  BWn   : n is any number.  Means step backward n workdays.
Packit 95306a
Packit 95306a
  CWD   : the closest work day (using the TomorrowFirst config variable).
Packit 95306a
  CWN   : the closest work day (looking forward first).
Packit 95306a
  CWP   : the closest work day (looking backward first).
Packit 95306a
Packit 95306a
  NWD   : next work day counting today
Packit 95306a
  PWD   : previous work day counting today
Packit 95306a
  DWD   : next/previous work day (TomorrowFirst config) counting today
Packit 95306a
Packit 95306a
  EASTER: select easter for this year (the M, W, D fields are ignored
Packit 95306a
          in the recur).
Packit 95306a
Packit 95306a
CWD, CWN, and CWP will usually return the same value, but if you are
Packit 95306a
starting at the middle day of a 3-day weekend (for example), it will return
Packit 95306a
either the first work day of the following week, or the last work day of
Packit 95306a
the previous week depending on whether it looks forward or backward first.
Packit 95306a
Packit 95306a
All flags are applied AFTER the recurrence dates are calculated, and they
Packit 95306a
may move a date outside of the date0 to date1 range.  No check is made for
Packit 95306a
this.
Packit 95306a
Packit 95306a
The workday flags do not act exactly the same as a business mode calculation.
Packit 95306a
For example, a date that is Saturday with a FW1 steps forward to the first
Packit 95306a
workday (i.e. Monday).
Packit 95306a
Packit 95306a
=item B<Date_Cmp>
Packit 95306a
Packit 95306a
 $flag = Date_Cmp($date1,$date2);
Packit 95306a
Packit 95306a
This takes two dates and compares them.  Almost all dates can be compared
Packit 95306a
using the Perl "cmp" command.  The only time this will not work is when
Packit 95306a
comparing dates in different time zones.  This routine will take that into
Packit 95306a
account.
Packit 95306a
Packit 95306a
NOTE:  This routine currently does little more than use "cmp", but once
Packit 95306a
the internal format for storing dates is in place (where time zone information
Packit 95306a
is kept as part of the date), this routine will become more important.  You
Packit 95306a
should use this routine in preparation for that version.
Packit 95306a
Packit 95306a
=item B<DateCalc>
Packit 95306a
Packit 95306a
 $d = DateCalc($d1,$d2 [,\$err] [,$mode]);
Packit 95306a
Packit 95306a
This takes two dates, deltas, or one of each and performs the appropriate
Packit 95306a
calculation with them.  Dates must be a string that can be parsed by
Packit 95306a
ParseDateString.  Deltas must be a string that can be parsed by
Packit 95306a
ParseDateDelta.  Two deltas add together to form a third delta.  A date
Packit 95306a
and a delta returns a 2nd date.  Two dates return a delta (the difference
Packit 95306a
between the two dates).
Packit 95306a
Packit 95306a
Since the two items can be interpreted as either dates or deltas, and since
Packit 95306a
many types of dates can be interpreted as deltas (and vice versa), it is
Packit 95306a
a good idea to pass the input through ParseDate or ParseDateDelta as
Packit 95306a
appropriate. For example, the string "09:00:00" can be interpreted either
Packit 95306a
as a date (today at 9:00:00) or a delta (9 hours). To avoid unexpected
Packit 95306a
results, avoid calling DateCalc as:
Packit 95306a
Packit 95306a
  $d = DateCalc("09:00:00",$someothervalue);
Packit 95306a
Packit 95306a
Instead, call it as:
Packit 95306a
Packit 95306a
  $d = DateCalc(ParseDate("09:00:00"),$someothervalue);
Packit 95306a
Packit 95306a
to force it to be a date, or:
Packit 95306a
Packit 95306a
  $d = DateCalc(ParseDateDelta("09:00:00"),$someothervalue);
Packit 95306a
Packit 95306a
to force it to be a delta. This will avoid unexpected results.
Packit 95306a
Packit 95306a
Note that in many cases, it is somewhat ambiguous what the delta
Packit 95306a
actually refers to.  Although it is ALWAYS known how many months in a
Packit 95306a
year, hours in a day, etc., it is NOT known (in the generals case) how
Packit 95306a
many days are in a month.  As a result, the part of the delta
Packit 95306a
containing month/year and the part with sec/min/hr/day must be treated
Packit 95306a
separately.  For example, "Mar 31, 12:00:00" plus a delta of 1month
Packit 95306a
2days would yield "May 2 12:00:00".  The year/month is first handled
Packit 95306a
while keeping the same date.  Mar 31 plus one month is Apr 31 (but
Packit 95306a
since Apr only has 30 days, it becomes Apr 30).  Apr 30 + 2 days is
Packit 95306a
May 2.  As a result, in the case where two dates are entered, the
Packit 95306a
resulting delta can take on two different forms.  By default
Packit 95306a
($mode=0), an absolutely correct delta (ignoring daylight saving time)
Packit 95306a
is returned in weeks, days, hours, minutes, and seconds.
Packit 95306a
Packit 95306a
If $mode is 1, the math is done using an approximate mode where a delta is
Packit 95306a
returned using years and months as well.  The year and month part is
Packit 95306a
calculated first followed by the rest.  For example, the two dates "Mar 12
Packit 95306a
1995" and "Apr 13 1995" would have an exact delta of "31 days" but in the
Packit 95306a
approximate mode, it would be returned as "1 month 1 day".  Also, "Mar 31"
Packit 95306a
and "Apr 30" would have deltas of "30 days" or "1 month" (since Apr 31
Packit 95306a
doesn't exist, it drops down to Apr 30).  Approximate mode is a more human
Packit 95306a
way of looking at things (you'd say 1 month and 2 days more often then 33
Packit 95306a
days), but it is less meaningful in terms of absolute time.  In approximate
Packit 95306a
mode $d1 and $d2 must be dates.  If either or both is a delta, the
Packit 95306a
calculation is done in exact mode.
Packit 95306a
Packit 95306a
If $mode is 2, a business mode is used.  That is, the calculation is done
Packit 95306a
using business days, ignoring holidays, weekends, etc.  In order to
Packit 95306a
correctly use this mode, a config file must exist which contains the
Packit 95306a
section defining holidays (see documentation on the config file below).
Packit 95306a
The config file can also define the work week and the hours of the work
Packit 95306a
day, so it is possible to have different config files for different
Packit 95306a
businesses.
Packit 95306a
Packit 95306a
For example, if a config file defines the workday as 08:00 to 18:00, a
Packit 95306a
work week consisting of Mon-Sat, and the standard (American) holidays, then
Packit 95306a
from Tuesday at 12:00 to the following Monday at 14:00 is 5 days and 2
Packit 95306a
hours.  If the "end" of the day is reached in a calculation, it
Packit 95306a
automatically switches to the next day.  So, Tuesday at 12:00 plus 6 hours
Packit 95306a
is Wednesday at 08:00 (provided Wed is not a holiday).  Also, a date that
Packit 95306a
is not during a workday automatically becomes the start of the next
Packit 95306a
workday.  So, Sunday 12:00 and Monday at 03:00 both automatically becomes
Packit 95306a
Monday at 08:00 (provided Monday is not a holiday).  In business mode, any
Packit 95306a
combination of date and delta may be entered, but a delta should not
Packit 95306a
contain a year or month field (weeks are fine though).
Packit 95306a
Packit 95306a
See Date::Manip::Calc for some additional comments about business mode calculations.
Packit 95306a
Packit 95306a
Note that a business week is treated the same as an exact week (i.e. from
Packit 95306a
Tuesday to Tuesday, regardless of holidays).  Because this means that the
Packit 95306a
relationship between days and weeks is NOT unambiguous, when a delta is
Packit 95306a
produced from two dates, it will be in terms of d/h/mn/s (i.e. no week
Packit 95306a
field).
Packit 95306a
Packit 95306a
If $mode is 3 (which only applies when two dates are passed in), an exact
Packit 95306a
business mode is used.  In this case, it returns a delta as an exact number
Packit 95306a
of business days/hours/etc. between the two.  Weeks, months, and years are
Packit 95306a
ignored.
Packit 95306a
Packit 95306a
Any other non-nil value of $mode is treated as $mode=1 (approximate mode).
Packit 95306a
Packit 95306a
The mode can be automatically set in the dates/deltas passed by including a
Packit 95306a
key word somewhere in it.  For example, in English, if the word
Packit 95306a
"approximately" is found in either of the date/delta arguments, approximate
Packit 95306a
mode is forced.  Likewise, if the word "business" or "exactly" appears,
Packit 95306a
business/exact mode is forced (and $mode is ignored).  So, the two
Packit 95306a
following are equivalent:
Packit 95306a
Packit 95306a
   $date = DateCalc("today","+ 2 business days",\$err);
Packit 95306a
   $date = DateCalc("today","+ 2 days",\$err,2);
Packit 95306a
Packit 95306a
Note that if the keyword method is used instead of passing in $mode, it is
Packit 95306a
important that the keyword actually appear in the argument passed in to
Packit 95306a
DateCalc.  The following will NOT work:
Packit 95306a
Packit 95306a
   $delta = ParseDateDelta("+ 2 business days");
Packit 95306a
   $today = ParseDate("today");
Packit 95306a
   $date = DateCalc($today,$delta,\$err);
Packit 95306a
Packit 95306a
because the mode keyword is removed from a date/delta by the parse routines,
Packit 95306a
and the mode is reset each time a parse routine is called.  Since DateCalc
Packit 95306a
parses both of its arguments, whatever mode was previously set is ignored.
Packit 95306a
Packit 95306a
If \$err is passed in, it is set to:
Packit 95306a
   1 is returned if $d1 is not a delta or date
Packit 95306a
   2 is returned if $d2 is not a delta or date
Packit 95306a
   3 is returned if the date is outside the years 1000 to 9999
Packit 95306a
This argument is optional, but if included, it must come before $mode.
Packit 95306a
Packit 95306a
Nothing is returned if an error occurs.
Packit 95306a
Packit 95306a
When a delta is returned, the signs such that it is strictly positive or
Packit 95306a
strictly negative ("1 day - 2 hours" would never be returned for example).
Packit 95306a
The only time when this cannot be enforced is when two deltas with a
Packit 95306a
year/month component are entered.  In this case, only the signs on the
Packit 95306a
day/hour/min/sec part are standardized.
Packit 95306a
Packit 95306a
=item B<Date_SetTime>
Packit 95306a
Packit 95306a
 $date = Date_SetTime($date,$hr,$min,$sec);
Packit 95306a
 $date = Date_SetTime($date,$time);
Packit 95306a
Packit 95306a
This takes a date (any string that may be parsed by ParseDateString) and
Packit 95306a
sets the time in that date.  For example, one way to get the time for 7:30
Packit 95306a
tomorrow would be to use the lines:
Packit 95306a
Packit 95306a
   $date = ParseDate("tomorrow");
Packit 95306a
   $date = Date_SetTime($date,"7:30");
Packit 95306a
Packit 95306a
Note that in this routine (as well as the other routines below which use
Packit 95306a
a time argument), no real parsing is done on the times.  As a result,
Packit 95306a
Packit 95306a
   $date = Date_SetTime($date,"13:30");
Packit 95306a
Packit 95306a
works, but
Packit 95306a
Packit 95306a
   $date = Date_SetTime($date,"1:30 PM");
Packit 95306a
Packit 95306a
doesn't.
Packit 95306a
Packit 95306a
=item B<Date_SetDateField>
Packit 95306a
Packit 95306a
 $date = Date_SetDateField($date,$field,$val [,$nocheck]);
Packit 95306a
Packit 95306a
This takes a date and sets one of its fields to a new value.  $field is
Packit 95306a
any of the strings "y", "m", "d", "h", "mn", "s" (case insensitive) and
Packit 95306a
$val is the new value.
Packit 95306a
Packit 95306a
If $nocheck is non-zero, no check is made as to the validity of the date.
Packit 95306a
Packit 95306a
=item B<Date_GetPrev>
Packit 95306a
Packit 95306a
 $date = Date_GetPrev($date,$dow, $curr [,$hr,$min,$sec]);
Packit 95306a
 $date = Date_GetPrev($date,$dow, $curr [,$time]);
Packit 95306a
 $date = Date_GetPrev($date,undef,$curr,$hr,$min,$sec);
Packit 95306a
 $date = Date_GetPrev($date,undef,$curr,$time);
Packit 95306a
Packit 95306a
This takes a date (any string that may be parsed by ParseDateString) and finds
Packit 95306a
the previous occurrence of either a day of the week, or a certain time of day.
Packit 95306a
Packit 95306a
If $dow is defined, the previous occurrence of the day of week is returned.
Packit 95306a
$dow may either be a string (such as "Fri" or "Friday") or a number
Packit 95306a
(between 1 and 7).  The date of the previous $dow is returned.
Packit 95306a
Packit 95306a
If $date falls on the day of week given by $dow, the date returned depends
Packit 95306a
on $curr.  If $curr is 0, the date returned is a week before $date.  If
Packit 95306a
$curr is 1, the date returned is the same as $date.  If $curr is 2, the date
Packit 95306a
returned (including the time information) is required to be before $date.
Packit 95306a
Packit 95306a
If a time is passed in (either as separate hours, minutes, seconds or as a
Packit 95306a
time in HH:MM:SS or HH:MM format), the time on this date is set to it.  The
Packit 95306a
following examples should illustrate the use of Date_GetPrev:
Packit 95306a
Packit 95306a
    date                   dow    curr  time            returns
Packit 95306a
    Fri Nov 22 18:15:00    Thu    any   12:30           Thu Nov 21 12:30:00
Packit 95306a
    Fri Nov 22 18:15:00    Fri    0     12:30           Fri Nov 15 12:30:00
Packit 95306a
    Fri Nov 22 18:15:00    Fri    1/2   12:30           Fri Nov 22 12:30:00
Packit 95306a
Packit 95306a
    Fri Nov 22 18:15:00    Fri    1     18:30           Fri Nov 22 18:30:00
Packit 95306a
    Fri Nov 22 18:15:00    Fri    2     18:30           Fri Nov 15 18:30:00
Packit 95306a
Packit 95306a
If $dow is undefined, then a time must be entered, and the date returned is
Packit 95306a
the previous occurrence of this time.  If $curr is non-zero, the current
Packit 95306a
time is returned if it matches the criteria passed in.  In other words, the
Packit 95306a
time returned is the last time that a digital clock (in 24 hour mode) would
Packit 95306a
have displayed the time you passed in.  If you define hours, minutes and
Packit 95306a
seconds default to 0 and you might jump back as much as an entire day.  If
Packit 95306a
hours are undefined, you are looking for the last time the minutes/seconds
Packit 95306a
appeared on the digital clock, so at most, the time will jump back one hour.
Packit 95306a
Packit 95306a
    date               curr  hr     min    sec      returns
Packit 95306a
    Nov 22 18:15:00    0/1   18     undef  undef    Nov 22 18:00:00
Packit 95306a
    Nov 22 18:15:00    0/1   18     30     0        Nov 21 18:30:00
Packit 95306a
    Nov 22 18:15:00    0     18     15     undef    Nov 21 18:15:00
Packit 95306a
    Nov 22 18:15:00    1     18     15     undef    Nov 22 18:15:00
Packit 95306a
    Nov 22 18:15:00    0     undef  15     undef    Nov 22 17:15:00
Packit 95306a
    Nov 22 18:15:00    1     undef  15     undef    Nov 22 18:15:00
Packit 95306a
Packit 95306a
=item B<Date_GetNext>
Packit 95306a
Packit 95306a
 $date = Date_GetNext($date,$dow, $curr [,$hr,$min,$sec]);
Packit 95306a
 $date = Date_GetNext($date,$dow, $curr [,$time]);
Packit 95306a
 $date = Date_GetNext($date,undef,$curr,$hr,$min,$sec);
Packit 95306a
 $date = Date_GetNext($date,undef,$curr,$time);
Packit 95306a
Packit 95306a
Similar to Date_GetPrev.
Packit 95306a
Packit 95306a
=item B<Date_IsHoliday>
Packit 95306a
Packit 95306a
 $name = Date_IsHoliday($date);
Packit 95306a
Packit 95306a
This returns undef if $date is not a holiday, or a string containing the
Packit 95306a
name of the holiday otherwise.  An empty string is returned for an unnamed
Packit 95306a
holiday.
Packit 95306a
Packit 95306a
=item B<Events_List>
Packit 95306a
Packit 95306a
 $ref = Events_List($date);
Packit 95306a
 $ref = Events_List($date ,0      [,$flag]);
Packit 95306a
 $ref = Events_List($date0,$date1 [,$flag]);
Packit 95306a
Packit 95306a
This returns a list of events.  Events are defined in the Events section
Packit 95306a
of the config file (discussed below).
Packit 95306a
Packit 95306a
In the first form (a single argument), $date is any string containing a
Packit 95306a
date.  A list of events active at that precise time will be returned.
Packit 95306a
The format is similar to when $flag=0, except only a single time will
Packit 95306a
be returned.
Packit 95306a
Packit 95306a
In all other cases, a range of times will be used.  If the 2nd argument
Packit 95306a
evaluates to 0, the range of times will be the 24 hour period from
Packit 95306a
midnight to midnight containing $date.  Otherwise, the range is given
Packit 95306a
by the two dates.
Packit 95306a
Packit 95306a
The value of $flag determines the format of the information that is
Packit 95306a
returned.
Packit 95306a
Packit 95306a
With $flag=0, the events are returned as a reference to a list of the form:
Packit 95306a
Packit 95306a
  [ date, [ list_of_events ], date, [ list_of_events ], ... ]
Packit 95306a
Packit 95306a
For example, if the following events are defined (using the syntax
Packit 95306a
discussed below in the description of the Event section of the config
Packit 95306a
file):
Packit 95306a
Packit 95306a
  2000-01-01 ; 2000-03-21  = Winter
Packit 95306a
  2000-03-22 ; 2000-06-21  = Spring
Packit 95306a
  2000-02-01               = Event1
Packit 95306a
  2000-05-01               = Event2
Packit 95306a
  2000-04-01-12:00:00      = Event3
Packit 95306a
Packit 95306a
might result in the following output:
Packit 95306a
Packit 95306a
  Events_List("2000-04-01")
Packit 95306a
   => [ 2000040100:00:00, [ Spring ] ]
Packit 95306a
Packit 95306a
  Events_List("2000-04-01 12:30");
Packit 95306a
   => [ 2000040112:30:00, [ Spring, Event3 ] ]
Packit 95306a
Packit 95306a
  Events_List("2000-04-01",0);
Packit 95306a
   => [ 2000040100:00:00, [ Spring ],
Packit 95306a
        2000040112:00:00, [ Spring, Event3 ],
Packit 95306a
        2000040113:00:00, [ Spring ] ]
Packit 95306a
Packit 95306a
  Events_List("2000-03-15","2000-04-10");
Packit 95306a
   => [ 2000031500:00:00, [ Winter ],
Packit 95306a
        2000032200:00:00, [ Spring ]
Packit 95306a
        2000040112:00:00, [ Spring, Event3 ]
Packit 95306a
        2000040113:00:00, [ Spring ] ]
Packit 95306a
Packit 95306a
Much more complicated events can be defined using recurrences.
Packit 95306a
Packit 95306a
When $flag is non-zero, the format of the output is changed.  If $flag
Packit 95306a
is 1, then a tally of the amount of time given to each event is returned.
Packit 95306a
Time for which two or more events apply is counted for both.
Packit 95306a
Packit 95306a
  Events_List("2000-03-15","2000-04-10",1);
Packit 95306a
   => { Winter => +0:0:1:0:0:0:0,
Packit 95306a
        Spring => +0:0:2:5:0:0:0,
Packit 95306a
        Event3 => +0:0:0:0:1:0:0 }
Packit 95306a
Packit 95306a
When $flag is 2, a more complex tally with no event counted twice is
Packit 95306a
returned.
Packit 95306a
Packit 95306a
  Events_List("2000-03-15","2000-04-10",2);
Packit 95306a
   => { Winter => +0:0:1:0:0:0:0,
Packit 95306a
        Spring => +0:0:2:4:23:0:0,
Packit 95306a
        Event3+Spring => +0:0:0:0:1:0:0 }
Packit 95306a
Packit 95306a
The hash contains one element for each combination of events.
Packit 95306a
Packit 95306a
=item B<Date_DayOfWeek>
Packit 95306a
Packit 95306a
 $day = Date_DayOfWeek($m,$d,$y);
Packit 95306a
Packit 95306a
Returns the day of the week (1 for Monday, 7 for Sunday).
Packit 95306a
Packit 95306a
All arguments must be numeric.
Packit 95306a
Packit 95306a
=item B<Date_SecsSince1970>
Packit 95306a
Packit 95306a
 $secs = Date_SecsSince1970($m,$d,$y,$h,$mn,$s);
Packit 95306a
Packit 95306a
Returns the number of seconds since Jan 1, 1970 00:00 (negative if date is
Packit 95306a
earlier).
Packit 95306a
Packit 95306a
All arguments must be numeric.
Packit 95306a
Packit 95306a
=item B<Date_SecsSince1970GMT>
Packit 95306a
Packit 95306a
 $secs = Date_SecsSince1970GMT($m,$d,$y,$h,$mn,$s);
Packit 95306a
Packit 95306a
Returns the number of seconds since Jan 1, 1970 00:00 GMT (negative if date
Packit 95306a
is earlier).  If CurrTZ is "IGNORE", the number will be identical to
Packit 95306a
Date_SecsSince1970 (i.e. the date given will be treated as being in GMT).
Packit 95306a
Packit 95306a
All arguments must be numeric.
Packit 95306a
Packit 95306a
=item B<Date_DaysSince1BC>
Packit 95306a
Packit 95306a
 $days = Date_DaysSince1BC($m,$d,$y);
Packit 95306a
Packit 95306a
Returns the number of days since Dec 31, 1BC.  This includes the year 0000.
Packit 95306a
Packit 95306a
All arguments must be numeric.
Packit 95306a
Packit 95306a
=item B<Date_DayOfYear>
Packit 95306a
Packit 95306a
 $day = Date_DayOfYear($m,$d,$y);
Packit 95306a
Packit 95306a
Returns the day of the year (001 to 366)
Packit 95306a
Packit 95306a
All arguments must be numeric.
Packit 95306a
Packit 95306a
=item B<Date_NthDayOfYear>
Packit 95306a
Packit 95306a
 ($y,$m,$d,$h,$mn,$s) = Date_NthDayOfYear($y,$n);
Packit 95306a
Packit 95306a
Returns the year, month, day, hour, minutes, and decimal seconds given
Packit 95306a
a floating point day of the year.
Packit 95306a
Packit 95306a
All arguments must be numeric.  $n must be greater than or equal to 1
Packit 95306a
and less than 366 on non-leap years and 367 on leap years.
Packit 95306a
Packit 95306a
NOTE: When $n is a decimal number, the results are non-intuitive perhaps.
Packit 95306a
Day 1 is Jan 01 00:00.  Day 2 is Jan 02 00:00.  Intuitively, you
Packit 95306a
might think of day 1.5 as being 1.5 days after Jan 01 00:00, but this
Packit 95306a
would mean that Day 1.5 was Jan 02 12:00 (which is later than Day 2).
Packit 95306a
The best way to think of this function is a time line starting at 1 and
Packit 95306a
ending at 366 (in a non-leap year).  In terms of a delta, think of $n
Packit 95306a
as the number of days after Dec 31 00:00 of the previous year.
Packit 95306a
Packit 95306a
=item B<Date_DaysInYear>
Packit 95306a
Packit 95306a
 $days = Date_DaysInYear($y);
Packit 95306a
Packit 95306a
Returns the number of days in the year (365 or 366)
Packit 95306a
Packit 95306a
=item B<Date_DaysInMonth>
Packit 95306a
Packit 95306a
 $days = Date_DaysInMonth($m,$y);
Packit 95306a
Packit 95306a
Returns the number of days in the month.
Packit 95306a
Packit 95306a
=item B<Date_WeekOfYear>
Packit 95306a
Packit 95306a
 $wkno = Date_WeekOfYear($m,$d,$y,$first);
Packit 95306a
Packit 95306a
Figure out week number.  $first is the first day of the week which is
Packit 95306a
usually 1 (Monday) or 7 (Sunday), but could be any number between 1 and 7
Packit 95306a
in practice.
Packit 95306a
Packit 95306a
All arguments must be numeric.
Packit 95306a
Packit 95306a
NOTE: This routine should only be called in rare cases.  Use UnixDate with
Packit 95306a
the %W, %U, %J, %L formats instead.  This routine returns a week between 0
Packit 95306a
and 53 which must then be "fixed" to get into the ISO-8601 weeks from 1 to
Packit 95306a
53.  A date which returns a week of 0 actually belongs to the last week of
Packit 95306a
the previous year.  A date which returns a week of 53 may belong to the
Packit 95306a
first week of the next year.
Packit 95306a
Packit 95306a
=item B<Date_LeapYear>
Packit 95306a
Packit 95306a
 $flag = Date_LeapYear($y);
Packit 95306a
Packit 95306a
Returns 1 if the argument is a leap year
Packit 95306a
Written by David Muir Sharnoff <muir@idiom.com>
Packit 95306a
Packit 95306a
=item B<Date_DaySuffix>
Packit 95306a
Packit 95306a
 $day = Date_DaySuffix($d);
Packit 95306a
Packit 95306a
Add `st', `nd', `rd', `th' to a date (i.e. 1st, 22nd, 29th).  Works for
Packit 95306a
international dates.
Packit 95306a
Packit 95306a
=item B<Date_TimeZone>
Packit 95306a
Packit 95306a
 $tz = Date_TimeZone;
Packit 95306a
Packit 95306a
This determines and returns the local time zone.  If it is unable to determine
Packit 95306a
the local time zone, the following error occurs:
Packit 95306a
Packit 95306a
   ERROR: Date::Manip unable to determine Time Zone.
Packit 95306a
Packit 95306a
See The TIME ZONES section below for more information.
Packit 95306a
Packit 95306a
=item B<Date_ConvTZ>
Packit 95306a
Packit 95306a
 $date = Date_ConvTZ($date);
Packit 95306a
 $date = Date_ConvTZ($date,$from);
Packit 95306a
 $date = Date_ConvTZ($date,"",$to [,$errlev]);
Packit 95306a
 $date = Date_ConvTZ($date,$from,$to [,$errlev]);
Packit 95306a
Packit 95306a
This converts a date (which MUST be in the format returned by ParseDate)
Packit 95306a
from one time zone to another.
Packit 95306a
Packit 95306a
If it is called with no arguments, the date is converted from the local
Packit 95306a
time zone to the time zone specified by the config variable ConvTZ (see
Packit 95306a
documentation on ConvTZ below).  If ConvTZ is set to "IGNORE", no
Packit 95306a
conversion is done.
Packit 95306a
Packit 95306a
If called with $from but no $to, the time zone is converted from the
Packit 95306a
time zone in $from to ConvTZ (of TZ if ConvTZ is not set).  Again, no
Packit 95306a
conversion is done if ConvTZ is set to "IGNORE".
Packit 95306a
Packit 95306a
If called with $to but no $from, $from defaults to ConvTZ (if set) or the
Packit 95306a
local time zone otherwise.  Although this does not seem immediately obvious,
Packit 95306a
it actually makes sense.  By default, all dates that are parsed are
Packit 95306a
converted to ConvTZ, so most of the dates being worked with will be stored
Packit 95306a
in that time zone.
Packit 95306a
Packit 95306a
If Date_ConvTZ is called with both $from and $to, the date is converted
Packit 95306a
from the time zone $from to $to.
Packit 95306a
Packit 95306a
NOTE: As in all other cases, the $date returned from Date_ConvTZ has no
Packit 95306a
time zone information included as part of it, so calling UnixDate with the
Packit 95306a
"%z" format will return the time zone that Date::Manip is working in
Packit 95306a
(usually the local time zone).
Packit 95306a
Packit 95306a
Example:  To convert 2/2/96 noon PST to CST (regardless of what time zone
Packit 95306a
you are in, do the following:
Packit 95306a
Packit 95306a
 $date = ParseDate("2/2/96 noon");
Packit 95306a
 $date = Date_ConvTZ($date,"PST","CST");
Packit 95306a
Packit 95306a
Both time zones MUST be in one of the formats listed below in the section
Packit 95306a
TIME ZONES.
Packit 95306a
Packit 95306a
If an error occurs, $errlev determines what happens:
Packit 95306a
Packit 95306a
  0   : the program dies
Packit 95306a
  1   : a warning is produced and nothing is returned
Packit 95306a
  2   : the function silently returns nothing
Packit 95306a
Packit 95306a
=item B<Date_IsWorkDay>
Packit 95306a
Packit 95306a
  $flag = Date_IsWorkDay($date [,$flag]);
Packit 95306a
Packit 95306a
This returns 1 if $date is a work day.  If $flag is non-zero, the time is
Packit 95306a
checked to see if it falls within work hours.  It returns an empty string
Packit 95306a
if $date is not valid.
Packit 95306a
Packit 95306a
=item B<Date_NextWorkDay>
Packit 95306a
Packit 95306a
  $date = Date_NextWorkDay($date,$off [,$flag]);
Packit 95306a
Packit 95306a
Finds the day $off work days from now.  If $flag is non-zero, we must also
Packit 95306a
take into account the time of day.
Packit 95306a
Packit 95306a
If $flag is zero, day 0 is today (if today is a workday) or the
Packit 95306a
next work day if it isn't.  In any case, the time of day is unaffected.
Packit 95306a
Packit 95306a
If $flag is non-zero, day 0 is now (if now is part of a workday) or the
Packit 95306a
start of the very next work day.
Packit 95306a
Packit 95306a
=item B<Date_PrevWorkDay>
Packit 95306a
Packit 95306a
  $date = Date_PrevWorkDay($date,$off [,$flag]);
Packit 95306a
Packit 95306a
Similar to Date_NextWorkDay.
Packit 95306a
Packit 95306a
=item B<Date_NearestWorkDay>
Packit 95306a
Packit 95306a
  $date = Date_NearestWorkDay($date [,$tomorrowfirst]);
Packit 95306a
Packit 95306a
This looks for the work day nearest to $date.  If $date is a work day, it
Packit 95306a
is returned.  Otherwise, it will look forward or backwards in time 1 day
Packit 95306a
at a time until a work day is found.  If $tomorrowfirst is non-zero (or if
Packit 95306a
it is omitted and the config variable TomorrowFirst is non-zero), we look
Packit 95306a
to the future first.  Otherwise, we look in the past first.  In other words,
Packit 95306a
in a normal week, if $date is Wednesday, $date is returned.  If $date is
Packit 95306a
Saturday, Friday is returned.  If $date is Sunday, Monday is returned.  If
Packit 95306a
Wednesday is a holiday, Thursday is returned if $tomorrowfirst is non-nil
Packit 95306a
or Tuesday otherwise.
Packit 95306a
Packit 95306a
=item B<DateManipVersion>
Packit 95306a
Packit 95306a
  $version = DateManipVersion;
Packit 95306a
Packit 95306a
Returns the version of Date::Manip.
Packit 95306a
Packit 95306a
=back
Packit 95306a
Packit 95306a
=head1 TIME ZONES
Packit 95306a
Packit 95306a
With the release of Date::Manip 6.00, time zones and daylight saving
Packit 95306a
time are now fully supported in Date::Manip. 6.00 uses information from
Packit 95306a
several standards (most importantly the Olson zoneinfo database) to get
Packit 95306a
a list of all known time zones.
Packit 95306a
Packit 95306a
Unfortunately, 6.00 requires a newer version of perl, so I will continue
Packit 95306a
to support the 5.xx release for a while. However, the way I will support
Packit 95306a
time zones in 5.xx has changed. Previously, new time zones would be added
Packit 95306a
on request. That is no longer the case. Time zones for 5.xx are now generated
Packit 95306a
automatically from those available in 6.00.
Packit 95306a
Packit 95306a
The following time zone names are currently understood (and can be used in
Packit 95306a
parsing dates).  These are zones defined in RFC 822.
Packit 95306a
Packit 95306a
    Universal:  GMT, UT
Packit 95306a
    US zones :  EST, EDT, CST, CDT, MST, MDT, PST, PDT
Packit 95306a
    Military :  A to Z (except J)
Packit 95306a
    Other    :  +HHMM or -HHMM
Packit 95306a
    ISO 8601 :  +HH:MM, +HH, -HH:MM, -HH
Packit 95306a
Packit 95306a
In addition, the following time zone abbreviations are also accepted. These
Packit 95306a
do not come from a standard, but were included in previous releases of
Packit 95306a
Date::Manip 5.xx and are preserved here for backward compatibility:
Packit 95306a
Packit 95306a
   IDLW    -1200    International Date Line West
Packit 95306a
   NT      -1100    Nome
Packit 95306a
   SAT     -0400    Chile
Packit 95306a
   CLDT    -0300    Chile Daylight
Packit 95306a
   AT      -0200    Azores
Packit 95306a
   MEWT    +0100    Middle European Winter
Packit 95306a
   MEZ     +0100    Middle European
Packit 95306a
   FWT     +0100    French Winter
Packit 95306a
   GB      +0100    GMT with daylight savings
Packit 95306a
   SWT     +0100    Swedish Winter
Packit 95306a
   MESZ    +0200    Middle European Summer
Packit 95306a
   FST     +0200    French Summer
Packit 95306a
   METDST  +0200    An alias for MEST used by HP-UX
Packit 95306a
   EETDST  +0300    An alias for eest used by HP-UX
Packit 95306a
   EETEDT  +0300    Eastern Europe, USSR Zone 1
Packit 95306a
   BT      +0300    Baghdad, USSR Zone 2
Packit 95306a
   IT      +0330    Iran
Packit 95306a
   ZP4     +0400    USSR Zone 3
Packit 95306a
   ZP5     +0500    USSR Zone 4
Packit 95306a
   IST     +0530    Indian Standard
Packit 95306a
   ZP6     +0600    USSR Zone 5
Packit 95306a
   AWST    +0800    Australian Western Standard
Packit 95306a
   ROK     +0900    Republic of Korea
Packit 95306a
   AEST    +1000    Australian Eastern Standard
Packit 95306a
   ACDT    +1030    Australian Central Daylight
Packit 95306a
   CADT    +1030    Central Australian Daylight
Packit 95306a
   AEDT    +1100    Australian Eastern Daylight
Packit 95306a
   EADT    +1100    Eastern Australian Daylight
Packit 95306a
   NZT     +1200    New Zealand
Packit 95306a
   IDLE    +1200    International Date Line East
Packit 95306a
Packit 95306a
All other time zone abbreviations come from the standards. In many
Packit 95306a
cases, an abbreviation may be used for multiple time zones. For
Packit 95306a
example, NST stands for Newfoundland Standard -0330 and North Sumatra
Packit 95306a
+0630.  In these cases, only 1 of the two is available. I have tried
Packit 95306a
to use the most recent definition, and of those (if multiple time zones
Packit 95306a
use the abbreviation), the most commonly used. I don't claim that I'm
Packit 95306a
correct in all cases, but I've done the best I could.
Packit 95306a
Packit 95306a
The list of abbreviations available is documented in the
Packit 95306a
Date::Manip::DM5abbrevs document.
Packit 95306a
Packit 95306a
Date::Manip must be able to determine the time zone the user is in.  It does
Packit 95306a
this by looking in the following places:
Packit 95306a
Packit 95306a
   $Date::Manip::TZ (set with Date_Init or in Manip.pm)
Packit 95306a
   $ENV{TZ}
Packit 95306a
   the Unix `date` command (if available)
Packit 95306a
   $main::TZ
Packit 95306a
   /etc/TIMEZONE
Packit 95306a
   /etc/time zone
Packit 95306a
Packit 95306a
At least one of these should contain a time zone in one of the supported
Packit 95306a
forms.  If none do by default, the TZ variable must be set with Date_Init.
Packit 95306a
Packit 95306a
The time zone may be in the STD#DST format (in which case both abbreviations
Packit 95306a
must be in the table above) or any of the formats described above.  The
Packit 95306a
STD#DST format is NOT available when parsing a date however.  The following
Packit 95306a
forms are also available and are treated similar to the STD#DST forms:
Packit 95306a
Packit 95306a
      US/Pacific
Packit 95306a
      US/Mountain
Packit 95306a
      US/Central
Packit 95306a
      US/Eastern
Packit 95306a
      Canada/Pacific
Packit 95306a
      Canada/Mountain
Packit 95306a
      Canada/Central
Packit 95306a
      Canada/Eastern
Packit 95306a
Packit 95306a
=head1 CUSTOMIZING DATE::MANIP
Packit 95306a
Packit 95306a
There are a number of variables which can be used to customize the way
Packit 95306a
Date::Manip behaves.  There are also several ways to set these variables.
Packit 95306a
Packit 95306a
At the top of the Manip.pm file, there is a section which contains all
Packit 95306a
customization variables.  These provide the default values.
Packit 95306a
Packit 95306a
These can be overridden in a global config file if one is present (this
Packit 95306a
file is optional).  If the GlobalCnf variable is set in the Manip.pm file,
Packit 95306a
it contains the full path to a config file.  If the file exists, its
Packit 95306a
values will override those set in the Manip.pm file.  A sample config file
Packit 95306a
is included with the Date::Manip distribution.  Modify it as appropriate
Packit 95306a
and copy it to some appropriate directory and set the GlobalCnf variable in
Packit 95306a
the Manip.pm file.
Packit 95306a
Packit 95306a
Each user can have a personal config file which is of the same form as the
Packit 95306a
global config file.  The variables PersonalCnf and PersonalCnfPath set the
Packit 95306a
name and search path for the personal config file.  This file is also
Packit 95306a
optional.  If present, it overrides any values set in the global file.
Packit 95306a
Packit 95306a
NOTE: if you use business mode calculations, you must have a config file
Packit 95306a
(either global or personal) since this is the only place where you can
Packit 95306a
define holidays.
Packit 95306a
Packit 95306a
Finally, any variables passed in through Date_Init override all other
Packit 95306a
values.
Packit 95306a
Packit 95306a
A config file can be composed of several sections.  The first section sets
Packit 95306a
configuration variables.  Lines in this section are of the form:
Packit 95306a
Packit 95306a
   VARIABLE = VALUE
Packit 95306a
Packit 95306a
For example, to make the default language French, include the line:
Packit 95306a
Packit 95306a
   Language = French
Packit 95306a
Packit 95306a
Only variables described below may be used.  Blank lines and lines beginning
Packit 95306a
with a pound sign (#) are ignored.  All spaces are optional and strings are
Packit 95306a
case insensitive.
Packit 95306a
Packit 95306a
A line which starts with an asterisk (*) designates a new section.  For
Packit 95306a
example, the HOLIDAY section starts with a line:
Packit 95306a
Packit 95306a
   *Holiday
Packit 95306a
Packit 95306a
The various sections are defined below.
Packit 95306a
Packit 95306a
=head1 DATE::MANIP VARIABLES
Packit 95306a
Packit 95306a
All Date::Manip variables which can be used are described in the following
Packit 95306a
section.
Packit 95306a
Packit 95306a
=over 4
Packit 95306a
Packit 95306a
=item B<IgnoreGlobalCnf>
Packit 95306a
Packit 95306a
If this variable is used (any value is ignored), the global config file
Packit 95306a
is not read.  It must be present in the initial call to Date_Init or the
Packit 95306a
global config file will be read.
Packit 95306a
Packit 95306a
=item B<EraseHolidays>
Packit 95306a
Packit 95306a
If this variable is used (any value is ignored), the current list of
Packit 95306a
defined holidays is erased.  A new set will be set the next time a
Packit 95306a
config file is read in.  This can be set in either the global config file
Packit 95306a
or as a Date_Init argument (in which case holidays can be read in from
Packit 95306a
both the global and personal config files) or in the personal config file
Packit 95306a
(in which case, only holidays in the personal config file are counted).
Packit 95306a
Packit 95306a
=item B<PathSep>
Packit 95306a
Packit 95306a
This is a regular expression used to separate multiple paths.  For example,
Packit 95306a
on Unix, it defaults to a colon (:) so that multiple paths can be written
Packit 95306a
PATH1:PATH2 .  For Win32 platforms, it defaults to a semicolon (;) so that
Packit 95306a
paths such as "c:\;d:\" will work.
Packit 95306a
Packit 95306a
=item B<GlobalCnf>
Packit 95306a
Packit 95306a
This variable can be passed into Date_Init to point to a global
Packit 95306a
configuration file.  The value must be the complete path to a config file.
Packit 95306a
Packit 95306a
By default, no global config file is read.  Any time a global config file
Packit 95306a
is read, the holidays are erased.
Packit 95306a
Packit 95306a
Paths may have a tilde (~) expansion on platforms where this is supported
Packit 95306a
(currently Unix and VMS).
Packit 95306a
Packit 95306a
=item B<PersonalCnf>
Packit 95306a
Packit 95306a
This variable can be passed into Date_Init or set in a global config file
Packit 95306a
to set the name of the personal configuration file.
Packit 95306a
Packit 95306a
The default name for the config file is .DateManip.cnf on all Unix
Packit 95306a
platforms and Manip.cnf on all non-Unix platforms (because some of them
Packit 95306a
insist on 8.3 character filenames :-).
Packit 95306a
Packit 95306a
=item B<PersonalCnfPath>
Packit 95306a
Packit 95306a
This is a list of paths separated by the separator specified by the PathSep
Packit 95306a
variable.  These paths are each checked for the PersonalCnf config file.
Packit 95306a
Packit 95306a
Paths may have a tilde (~) expansion on platforms where this is supported
Packit 95306a
(currently Unix and VMS).
Packit 95306a
Packit 95306a
=item B<Language>
Packit 95306a
Packit 95306a
Date::Manip can be used to parse dates in many different languages.
Packit 95306a
Currently, it is configured to read  the following languages (the version
Packit 95306a
in which they added is included for historical interest):
Packit 95306a
Packit 95306a
  English      (default)
Packit 95306a
  French       (5.02)
Packit 95306a
  Swedish      (5.05)
Packit 95306a
  German       (5.31)
Packit 95306a
  Dutch        (5.32)     aka Nederlands
Packit 95306a
  Polish       (5.32)
Packit 95306a
  Spanish      (5.33)
Packit 95306a
  Portuguese   (5.34)
Packit 95306a
  Romanian     (5.35)
Packit 95306a
  Italian      (5.35)
Packit 95306a
  Russian      (5.41)
Packit 95306a
  Turkish      (5.41)
Packit 95306a
  Danish       (5.41)
Packit 95306a
Packit 95306a
Others can be added easily.  Language is set to the language used to parse
Packit 95306a
dates.  If you are interested in providing a translation for a new
Packit 95306a
language, email me (see the AUTHOR section below) and I'll send you a list
Packit 95306a
of things that I need.
Packit 95306a
Packit 95306a
=item B<DateFormat>
Packit 95306a
Packit 95306a
Different countries look at the date 12/10 as Dec 10 or Oct 12.  In the
Packit 95306a
United States, the first is most common, but this certainly doesn't hold
Packit 95306a
true for other countries.  Setting DateFormat to "US" forces the first
Packit 95306a
behavior (Dec 10).  Setting DateFormat to anything else forces the second
Packit 95306a
behavior (Oct 12).
Packit 95306a
Packit 95306a
=item B<TZ>
Packit 95306a
Packit 95306a
If set, this defines the local time zone.  See the TIME ZONES section above
Packit 95306a
for information on its format.
Packit 95306a
Packit 95306a
=item B<ConvTZ>
Packit 95306a
Packit 95306a
All date comparisons and calculations must be done in a single time zone in
Packit 95306a
order for them to work correctly.  So, when a date is parsed, it should be
Packit 95306a
converted to a specific time zone.  This allows dates to easily be compared
Packit 95306a
and manipulated as if they are all in a single time zone.
Packit 95306a
Packit 95306a
The ConvTZ variable determines which time zone should be used to store dates
Packit 95306a
in.  If it is left blank, all dates are converted to the local time zone
Packit 95306a
(see the TZ variable above).  If it is set to one of the time zones listed
Packit 95306a
above, all dates are converted to this time zone.  Finally, if it is set to
Packit 95306a
the string "IGNORE", all time zone information is ignored as the dates are
Packit 95306a
read in (in this case, the two dates "1/1/96 12:00 GMT" and "1/1/96 12:00
Packit 95306a
EST" would be treated as identical).
Packit 95306a
Packit 95306a
=item B<Internal>
Packit 95306a
Packit 95306a
When a date is parsed using ParseDate, that date is stored in an internal
Packit 95306a
format which is understood by the Date::Manip routines UnixDate and
Packit 95306a
DateCalc.  Originally, the format used to store the date internally was:
Packit 95306a
Packit 95306a
   YYYYMMDDHH:MN:SS
Packit 95306a
Packit 95306a
It has been suggested that I remove the colons (:) to shorten this to:
Packit 95306a
Packit 95306a
   YYYYMMDDHHMNSS
Packit 95306a
Packit 95306a
The main advantage of this is that some databases are colon delimited which
Packit 95306a
makes storing a date from Date::Manip tedious.
Packit 95306a
Packit 95306a
In order to maintain backwards compatibility, the Internal variable was
Packit 95306a
introduced.  Set it to 0 (to use the old format) or 1 (to use the new
Packit 95306a
format).
Packit 95306a
Packit 95306a
=item B<FirstDay>
Packit 95306a
Packit 95306a
It is sometimes necessary to know what day of week is regarded as first.
Packit 95306a
By default, this is set to Monday, but many countries and people will
Packit 95306a
prefer Sunday (and in a few cases, a different day may be desired).  Set
Packit 95306a
the FirstDay variable to be the first day of the week (1=Monday, 7=Sunday)
Packit 95306a
Monday should be chosen to to comply with ISO 8601.
Packit 95306a
Packit 95306a
=item B<WorkWeekBeg, WorkWeekEnd>
Packit 95306a
Packit 95306a
The first and last days of the work week.  By default, Monday and Friday.
Packit 95306a
WorkWeekBeg must come before WorkWeekEnd numerically.  The days are
Packit 95306a
numbered from 1 (Monday) to 7 (Sunday).
Packit 95306a
Packit 95306a
There is no way to handle an odd work week of Thu to Mon for example or 10
Packit 95306a
days on, 4 days off.
Packit 95306a
Packit 95306a
=item B<WorkDay24Hr>
Packit 95306a
Packit 95306a
If this is non-nil, a work day is treated as being 24 hours long.  The
Packit 95306a
WorkDayBeg and WorkDayEnd variables are ignored in this case.
Packit 95306a
Packit 95306a
=item B<WorkDayBeg, WorkDayEnd>
Packit 95306a
Packit 95306a
The times when the work day starts and ends.  WorkDayBeg must come before
Packit 95306a
WorkDayEnd (i.e. there is no way to handle the night shift where the work
Packit 95306a
day starts one day and ends another).  Also, the workday MUST be more than
Packit 95306a
one hour long (of course, if this isn't the case, let me know... I want a
Packit 95306a
job there!).
Packit 95306a
Packit 95306a
The time in both can be in any valid time format (including international
Packit 95306a
formats), but seconds will be ignored.
Packit 95306a
Packit 95306a
=item B<TomorrowFirst>
Packit 95306a
Packit 95306a
Periodically, if a day is not a business day, we need to find the nearest
Packit 95306a
business day to it.  By default, we'll look to "tomorrow" first, but if this
Packit 95306a
variable is set to 0, we'll look to "yesterday" first.  This is only used in
Packit 95306a
the Date_NearestWorkDay and is easily overridden (see documentation for that
Packit 95306a
function).
Packit 95306a
Packit 95306a
=item B<DeltaSigns>
Packit 95306a
Packit 95306a
Prior to Date::Manip version 5.07, a negative delta would put negative
Packit 95306a
signs in front of every component (i.e. "0:0:-1:-3:0:-4").  By default,
Packit 95306a
5.07 changes this behavior to print only 1 or two signs in front of the
Packit 95306a
year and day elements (even if these elements might be zero) and the sign
Packit 95306a
for year/month and day/hour/minute/second are the same.  Setting this
Packit 95306a
variable to non-zero forces deltas to be stored with a sign in front of
Packit 95306a
every element (including elements equal to 0).
Packit 95306a
Packit 95306a
=item B<Jan1Week1>
Packit 95306a
Packit 95306a
ISO 8601 states that the first week of the year is the one which contains
Packit 95306a
Jan 4 (i.e. it is the first week in which most of the days in that week
Packit 95306a
fall in that year).  This means that the first 3 days of the year may
Packit 95306a
be treated as belonging to the last week of the previous year.  If this
Packit 95306a
is set to non-nil, the ISO 8601 standard will be ignored and the first
Packit 95306a
week of the year contains Jan 1.
Packit 95306a
Packit 95306a
=item B<YYtoYYYY>
Packit 95306a
Packit 95306a
By default, a 2 digit year is treated as falling in the 100 year period of
Packit 95306a
CURR-89 to CURR+10.  YYtoYYYY may be set to any integer N to force a 2
Packit 95306a
digit year into the period CURR-N to CURR+(99-N).  A value of 0 forces
Packit 95306a
the year to be the current year or later.  A value of 99 forces the year
Packit 95306a
to be the current year or earlier.  Since I do no checking on the value of
Packit 95306a
YYtoYYYY, you can actually have it any positive or negative value to force
Packit 95306a
it into any century you want.
Packit 95306a
Packit 95306a
YYtoYYYY can also be set to "C" to force it into the current century, or
Packit 95306a
to "C##" to force it into a specific century.  So, in 1998, "C" forces
Packit 95306a
2 digit years to be 1900-1999 and "C18" would force it to be 1800-1899.
Packit 95306a
Packit 95306a
It can also be set to the form "C####" to force it into a specific 100
Packit 95306a
year period.  C1950 refers to 1950-2049.
Packit 95306a
Packit 95306a
=item B<UpdateCurrTZ>
Packit 95306a
Packit 95306a
If a script is running over a long period of time, the time zone may change
Packit 95306a
during the course of running it (i.e. when daylight saving time starts or
Packit 95306a
ends).  As a result, parsing dates may start putting them in the wrong time
Packit 95306a
zone.  Since a lot of overhead can be saved if we don't have to check the
Packit 95306a
current time zone every time a date is parsed, by default checking is turned
Packit 95306a
off.  Setting this to non-nil will force time zone checking to be done every
Packit 95306a
time a date is parsed... but this will result in a considerable performance
Packit 95306a
penalty.
Packit 95306a
Packit 95306a
A better solution would be to restart the process on the two days per year
Packit 95306a
where the time zone switch occurs.
Packit 95306a
Packit 95306a
=item B<IntCharSet>
Packit 95306a
Packit 95306a
If set to 0, use the US character set (7-bit ASCII) to return strings such
Packit 95306a
as the month name.  If set to 1, use the appropriate international character
Packit 95306a
set.  For example, If you want your French representation of December to
Packit 95306a
have the accent over the first "e", you'll want to set this to 1.
Packit 95306a
Packit 95306a
=item B<ForceDate>
Packit 95306a
Packit 95306a
This variable can be set to a date in the format: YYYY-MM-DD-HH:MN:SS
Packit 95306a
to force the current date to be interpreted as this date.  Since the current
Packit 95306a
date is used in parsing, this string will not be parsed and MUST be in the
Packit 95306a
format given above.
Packit 95306a
Packit 95306a
=item B<TodayIsMidnight>
Packit 95306a
Packit 95306a
If set to a true value (e.g. 1), then "today" will mean the same as
Packit 95306a
"midnight today"; otherwise it will mean the same as "now".
Packit 95306a
Packit 95306a
=back
Packit 95306a
Packit 95306a
=head1 HOLIDAY SECTION
Packit 95306a
Packit 95306a
The holiday section of the config file is used to define holidays.  Each
Packit 95306a
line is of the form:
Packit 95306a
Packit 95306a
   DATE = HOLIDAY
Packit 95306a
Packit 95306a
HOLIDAY is the name of the holiday (or it can be blank in which case the
Packit 95306a
day will still be treated as a holiday... for example the day after
Packit 95306a
Thanksgiving or Christmas is often a work holiday though neither are
Packit 95306a
named).
Packit 95306a
Packit 95306a
DATE is a string which can be parsed to give a valid date in any year.  It
Packit 95306a
can be of the form
Packit 95306a
Packit 95306a
   Date
Packit 95306a
   Date + Delta
Packit 95306a
   Date - Delta
Packit 95306a
   Recur
Packit 95306a
Packit 95306a
A valid holiday section would be:
Packit 95306a
Packit 95306a
   *Holiday
Packit 95306a
Packit 95306a
   1/1                             = New Year's Day
Packit 95306a
   third Monday in Feb             = Presidents' Day
Packit 95306a
   fourth Thu in Nov               = Thanksgiving
Packit 95306a
Packit 95306a
   # The Friday after Thanksgiving is an unnamed holiday most places
Packit 95306a
   fourth Thu in Nov + 1 day       =
Packit 95306a
Packit 95306a
   1*0:0:0:0:0:0*EASTER            = Easter
Packit 95306a
   1*11:0:11:0:0:0*DWD             = Veteran's Day (observed)
Packit 95306a
   1*0:0:0:0:0:0*EASTER,PD5        = Good Friday
Packit 95306a
Packit 95306a
In a Date + Delta or Date - Delta string, you can use business mode by
Packit 95306a
including the appropriate string (see documentation on DateCalc) in the
Packit 95306a
Date or Delta.  So (in English), the first workday before Christmas could
Packit 95306a
be defined as:
Packit 95306a
Packit 95306a
   12/25 - 1 business day          =
Packit 95306a
Packit 95306a
The dates may optionally contain the year.  For example, the dates
Packit 95306a
Packit 95306a
  1/1
Packit 95306a
  1/1/1999
Packit 95306a
Packit 95306a
refers to Jan 1 in any year or in only 1999 respectively.  For dates that
Packit 95306a
refer to any year, the date must be written such that by simply appending
Packit 95306a
the year (separated by spaces) it can be correctly interpreted.  This
Packit 95306a
will work for everything except ISO 8601 dates, so ISO 8601 dates may
Packit 95306a
not be used in this case.
Packit 95306a
Packit 95306a
Note that the dates are specified in whatever format is set using the
Packit 95306a
Date_Init options, so if the standard parsing is D/M/YYYY, you would
Packit 95306a
need to specify it as:
Packit 95306a
Packit 95306a
   25/12/2002           = Christmas
Packit 95306a
Packit 95306a
In cases where you are interested in business type calculations, you'll
Packit 95306a
want to define most holidays using recurrences, since they can define
Packit 95306a
when a holiday is celebrated in the financial world.  For example,
Packit 95306a
Christmas should be defined as:
Packit 95306a
Packit 95306a
   1*12:0:24:0:0:0*FW1  = Christmas
Packit 95306a
Packit 95306a
NOTE: It was pointed out to me that using a similar type recurrence to
Packit 95306a
define New Years does not work.  The recurrence:
Packit 95306a
Packit 95306a
   1*12:0:31:0:0:0*FW1
Packit 95306a
Packit 95306a
fails (worse, it goes into an infinite loop).  The problem is that each
Packit 95306a
holiday definition is applied to a specific year and it expects to find
Packit 95306a
the holiday for that year.  When this recurrence is applied to the year
Packit 95306a
1995, it returns the holiday for 1996 and fails.
Packit 95306a
Packit 95306a
Use the recurrence:
Packit 95306a
Packit 95306a
   1*1:0:1:0:0:0*NWD
Packit 95306a
Packit 95306a
instead.
Packit 95306a
Packit 95306a
If you wanted to define both Christmas and Boxing days (Boxing is the
Packit 95306a
day after Christmas, and is celebrated in some parts of the world), you
Packit 95306a
could do it in one of the following ways:
Packit 95306a
Packit 95306a
   1*12:0:24:0:0:0*FW1  = Christmas
Packit 95306a
   1*12:0:25:0:0:0*FW1  = Boxing
Packit 95306a
Packit 95306a
    1*12:0:24:0:0:0*FW1 = Christmas
Packit 95306a
   01*12:0:24:0:0:0*FW1 = Boxing
Packit 95306a
Packit 95306a
   1*12:0:24:0:0:0*FW1   = Christmas
Packit 95306a
   1*12:0:25:0:0:0*FW1,a = Boxing
Packit 95306a
Packit 95306a
The following examples will NOT work:
Packit 95306a
Packit 95306a
   1*12:0:24:0:0:0*FW1  = Christmas
Packit 95306a
   1*12:0:24:0:0:0*FW2  = Boxing
Packit 95306a
Packit 95306a
   1*12:0:24:0:0:0*FW1  = Christmas
Packit 95306a
   1*12:0:24:0:0:0*FW1  = Boxing
Packit 95306a
Packit 95306a
The reasoning behind all this is as follows:
Packit 95306a
Packit 95306a
Holidays go into affect the minute they are parsed.  So, in the case of:
Packit 95306a
Packit 95306a
   1*12:0:24:0:0:0*FW1  = Christmas
Packit 95306a
   1*12:0:24:0:0:0*FW2  = Boxing
Packit 95306a
Packit 95306a
the minute the first line is parsed, Christmas is defined as a holiday.
Packit 95306a
The second line then steps forward 2 work days (skipping Christmas since
Packit 95306a
that's no longer a work day) and define the work day two days after
Packit 95306a
Christmas, NOT the day after Christmas.
Packit 95306a
Packit 95306a
An good alternative would appear to be:
Packit 95306a
Packit 95306a
   1*12:0:24:0:0:0*FW1  = Christmas
Packit 95306a
   1*12:0:24:0:0:0*FW1  = Boxing
Packit 95306a
Packit 95306a
This unfortunately fails because the recurrences are currently stored in a
Packit 95306a
hash.  Since these two recurrences are identical, they fail (the first one
Packit 95306a
is overwritten by the second and in essence, Christmas is never defined).
Packit 95306a
Packit 95306a
To fix this, make them unique with either a fake flag (which is ignored):
Packit 95306a
Packit 95306a
   1*12:0:24:0:0:0*FW1,a  = Boxing
Packit 95306a
Packit 95306a
or adding an innocuous 0 somewhere:
Packit 95306a
Packit 95306a
   01*12:0:24:0:0:0*FW1   = Boxing
Packit 95306a
Packit 95306a
The other good alternative would be to make two completely different
Packit 95306a
recurrences such as:
Packit 95306a
Packit 95306a
   1*12:0:24:0:0:0*FW1  = Christmas
Packit 95306a
   1*12:0:25:0:0:0*FW1  = Boxing
Packit 95306a
Packit 95306a
At times, you may want to switch back and forth between two holiday files.
Packit 95306a
This can be done by calling the following:
Packit 95306a
Packit 95306a
  Date_Init("EraseHolidays=1","PersonalCnf=FILE1");
Packit 95306a
  ...
Packit 95306a
  Date_Init("EraseHolidays=1","PersonalCnf=FILE2");
Packit 95306a
  ...
Packit 95306a
Packit 95306a
=head1 EVENTS SECTION
Packit 95306a
Packit 95306a
The Events section of the config file is similar to the Holiday section.
Packit 95306a
It is used to name certain days or times, but there are a few important
Packit 95306a
differences:
Packit 95306a
Packit 95306a
=over 4
Packit 95306a
Packit 95306a
=item B<Events can be assigned to any time and duration>
Packit 95306a
Packit 95306a
All holidays are exactly 1 day long.  They are assigned to a period
Packit 95306a
of time from midnight to midnight.
Packit 95306a
Packit 95306a
Events can be based at any time of the day, and may be of any duration.
Packit 95306a
Packit 95306a
=item B<Events don't affect business mode calculations>
Packit 95306a
Packit 95306a
Unlike holidays, events are completely ignored when doing business
Packit 95306a
mode calculations.
Packit 95306a
Packit 95306a
=back
Packit 95306a
Packit 95306a
Whereas holidays were added with business mode math in mind, events
Packit 95306a
were added with calendar and scheduling applications in mind.
Packit 95306a
Packit 95306a
Every line in the events section is of the form:
Packit 95306a
Packit 95306a
   EVENT = NAME
Packit 95306a
Packit 95306a
where NAME is the name of the event, and EVENT defines when it occurs
Packit 95306a
and its duration.  An EVENT can be defined in the following ways:
Packit 95306a
Packit 95306a
   Date
Packit 95306a
   Date*
Packit 95306a
Packit 95306a
   Date  ; Date
Packit 95306a
   Date  ; Delta
Packit 95306a
Packit 95306a
Here, Date* refers to a string containing a Date with NO TIME fields
Packit 95306a
(Jan 12, 1/1/2000, 2010-01-01) while Date does contain time fields.
Packit 95306a
Similarly, Recur* stands for a recurrence with the time fields all
Packit 95306a
equal to 0) while Recur stands for a recurrence with at least one
Packit 95306a
non-zero time field.
Packit 95306a
Packit 95306a
Both Date* and Recur* refer to an event very similar to a holiday which
Packit 95306a
goes from midnight to midnight.
Packit 95306a
Packit 95306a
Date and Recur refer to events which occur at the time given and with
Packit 95306a
a duration of 1 hour.
Packit 95306a
Packit 95306a
Events given by "Date ; Date", "Date ; Delta", and "Recur ; Delta"
Packit 95306a
contain both the starting date and either ending date or duration.
Packit 95306a
Packit 95306a
Events given as three elements "Date ; Delta ; Delta" or "Recur ; Delta ;
Packit 95306a
Delta" take a date and add both deltas to it to give the starting and
Packit 95306a
ending time of the event.  The order and sign of the deltas is
Packit 95306a
unimportant (and both can be the same sign to give a range of times
Packit 95306a
which does not contain the base date).
Packit 95306a
Packit 95306a
=head1 KNOWN PROBLEMS
Packit 95306a
Packit 95306a
The following are not bugs in Date::Manip, but they may give some people
Packit 95306a
problems.
Packit 95306a
Packit 95306a
=over 4
Packit 95306a
Packit 95306a
=item B<Unable to determine Time Zone>
Packit 95306a
Packit 95306a
Perhaps the most common problem occurs when you get the error:
Packit 95306a
Packit 95306a
   Error: Date::Manip unable to determine Time Zone.
Packit 95306a
Packit 95306a
Date::Manip tries hard to determine the local time zone, but on some
Packit 95306a
machines, it cannot do this (especially non-Unix systems).  To fix this,
Packit 95306a
just set the TZ variable, either at the top of the Manip.pm file, in the
Packit 95306a
DateManip.cnf file, or in a call to Date_Init.  I suggest using the form
Packit 95306a
"EST5EDT" so you don't have to change it every 6 months when going to or
Packit 95306a
from daylight saving time.
Packit 95306a
Packit 95306a
Windows NT does not seem to set the time zone by default.  From the
Packit 95306a
Perl-Win32-Users mailing list:
Packit 95306a
Packit 95306a
   > How do I get the TimeZone on my NT?
Packit 95306a
   >
Packit 95306a
   >      $time_zone = $ENV{'TZ'};
Packit 95306a
   >
Packit 95306a
   You have to set the variable before, WinNT doesn't set it by
Packit 95306a
   default.  Open the properties of "My Computer" and set a SYSTEM
Packit 95306a
   variable TZ to your time zone.   Jenda@Krynicky.cz
Packit 95306a
Packit 95306a
This might help out some NT users.
Packit 95306a
Packit 95306a
A minor (false) assumption that some users might make is that since
Packit 95306a
Date::Manip passed all of its tests at install time, this should not occur
Packit 95306a
and are surprised when it does.
Packit 95306a
Packit 95306a
Some of the tests are time zone dependent.  Since the tests all include
Packit 95306a
input and expected output, I needed to know in advance what time zone they
Packit 95306a
would be run in.  So, the tests all explicitly set the time zone using the
Packit 95306a
TZ configuration variable passed into Date_Init.  Since this overrides any
Packit 95306a
other method of determining the time zone, Date::Manip uses this and doesn't
Packit 95306a
have to look elsewhere for the time zone.
Packit 95306a
Packit 95306a
When running outside the tests, Date::Manip has to rely on its other
Packit 95306a
methods for determining the time zone.
Packit 95306a
Packit 95306a
=item B<Missing date formats>
Packit 95306a
Packit 95306a
Please see the Date::Manip::Problems document for a discussion.
Packit 95306a
Packit 95306a
=item B<Complaining about getpwnam/getpwuid>
Packit 95306a
Packit 95306a
Another problem is when running on Micro$oft OS's.  I have added many
Packit 95306a
tests to catch them, but they still slip through occasionally.  If any ever
Packit 95306a
complain about getpwnam/getpwuid, simply add one of the lines:
Packit 95306a
Packit 95306a
  $ENV{OS} = Windows_NT
Packit 95306a
  $ENV{OS} = Windows_95
Packit 95306a
Packit 95306a
to your script before
Packit 95306a
Packit 95306a
  use Date::Manip
Packit 95306a
Packit 95306a
=item B<Date::Manip is slow>
Packit 95306a
Packit 95306a
The reasons for this are covered in the SHOULD I USE DATE::MANIP section
Packit 95306a
above.
Packit 95306a
Packit 95306a
Some things that will definitely help:
Packit 95306a
Packit 95306a
Version 5.21 does run noticeably faster than earlier versions due to
Packit 95306a
rethinking some of the initialization, so at the very least, make sure you
Packit 95306a
are running this version or later.
Packit 95306a
Packit 95306a
ISO-8601 dates are parsed first and fastest.  Use them whenever possible.
Packit 95306a
Packit 95306a
Avoid parsing dates that are referenced against the current time (in 2
Packit 95306a
days, today at noon, etc.).  These take a lot longer to parse.
Packit 95306a
Packit 95306a
   Example:  parsing 1065 dates with version 5.11 took 48.6 seconds, 36.2
Packit 95306a
   seconds with version 5.21, and parsing 1065 ISO-8601 dates with version
Packit 95306a
   5.21 took 29.1 seconds (these were run on a slow, overloaded computer with
Packit 95306a
   little memory... but the ratios should be reliable on a faster computer).
Packit 95306a
Packit 95306a
Business date calculations are extremely slow.  You should consider
Packit 95306a
alternatives if possible (i.e. doing the calculation in exact mode and
Packit 95306a
then multiplying by 5/7).  Who needs a business date more accurate
Packit 95306a
than "6 to 8 weeks" anyway, right :-)
Packit 95306a
Packit 95306a
Never call Date_Init more than once.  Unless you're doing something very
Packit 95306a
strange, there should never be a reason to anyway.
Packit 95306a
Packit 95306a
=item B<Sorting Problems>
Packit 95306a
Packit 95306a
If you use Date::Manip to sort a number of dates, you must call Date_Init
Packit 95306a
either explicitly, or by way of some other Date::Manip routine before it
Packit 95306a
is used in the sort.  For example, the following code fails:
Packit 95306a
Packit 95306a
   use Date::Manip;
Packit 95306a
   # Date_Init;
Packit 95306a
   sub sortDate {
Packit 95306a
       my($date1, $date2);
Packit 95306a
       $date1 = ParseDate($a);
Packit 95306a
       $date2 = ParseDate($b);
Packit 95306a
       return (Date_Cmp($date1,$date2));
Packit 95306a
   }
Packit 95306a
   @dates = ("Fri 16 Aug 96",
Packit 95306a
            "Mon 19 Aug 96",
Packit 95306a
            "Thu 15 Aug 96");
Packit 95306a
   @i=sort sortDate @dates;
Packit 95306a
Packit 95306a
but if you uncomment the Date_Init line, it works.  The reason for this is
Packit 95306a
that the first time you call Date_Init, it initializes a number of items
Packit 95306a
used by Date::Manip.  Some of these have to be sorted (regular expressions
Packit 95306a
sorted by length to ensure the longest match).  It turns out that Perl
Packit 95306a
has a bug in it which does not allow a sort within a sort.  At some point,
Packit 95306a
this should be fixed, but for now, the best thing to do is to call Date_Init
Packit 95306a
explicitly.  The bug exists in all versions up to 5.005 (I haven't
Packit 95306a
tested 5.6.0 yet).
Packit 95306a
Packit 95306a
NOTE: This is an EXTREMELY inefficient way to sort data (but read the 2nd
Packit 95306a
note below for an easy way to correct this).  Instead, you should parse the
Packit 95306a
dates with ParseDate, sort them using a normal string comparison, and then
Packit 95306a
convert them back to the format desired using UnixDate.
Packit 95306a
Packit 95306a
NOTE: It has been reported to me that you can still use ParseDate
Packit 95306a
to sort dates in this way, and be quite efficient through the use of
Packit 95306a
Memoize.  Just add the following lines to your code:
Packit 95306a
Packit 95306a
   use Date::Manip;
Packit 95306a
   use Memoize;
Packit 95306a
   memoize('ParseDate');
Packit 95306a
   ...
Packit 95306a
   @i=sort sortDate @dates;
Packit 95306a
Packit 95306a
Since sortDate would call ParseDate with the same data over and over,
Packit 95306a
this is a perfect application for the Memoize module.  So, sorting with
Packit 95306a
ParseDate is no longer slow for sorting.
Packit 95306a
Packit 95306a
=item B<RCS Control>
Packit 95306a
Packit 95306a
If you try to put Date::Manip under RCS control, you are going to have
Packit 95306a
problems.  Apparently, RCS replaces strings of the form "$Date...$" with
Packit 95306a
the current date.  This form occurs all over in Date::Manip.  To prevent the
Packit 95306a
RCS keyword expansion, checkout files using "co -ko".  Since very few people
Packit 95306a
will ever have a desire to do this (and I don't use RCS), I have not worried
Packit 95306a
about it.
Packit 95306a
Packit 95306a
=back
Packit 95306a
Packit 95306a
=head1 KNOWN BUGS
Packit 95306a
Packit 95306a
=over 4
Packit 95306a
Packit 95306a
=item B<Daylight Saving Times>
Packit 95306a
Packit 95306a
Date::Manip does not handle daylight saving time, though it does handle
Packit 95306a
time zones to a certain extent.  Converting from EST to PST works fine.
Packit 95306a
Going from EST to PDT is unreliable.
Packit 95306a
Packit 95306a
The following examples are run in the winter of the US East coast (i.e.
Packit 95306a
in the EST time zone).
Packit 95306a
Packit 95306a
	print UnixDate(ParseDate("6/1/97 noon"),"%u"),"\n";
Packit 95306a
        => Sun Jun  1 12:00:00 EST 1997
Packit 95306a
Packit 95306a
June 1 EST does not exist.  June 1st is during EDT.  It should print:
Packit 95306a
Packit 95306a
        => Sun Jun  1 00:00:00 EDT 1997
Packit 95306a
Packit 95306a
Even explicitly adding the time zone doesn't fix things (if anything, it
Packit 95306a
makes them worse):
Packit 95306a
Packit 95306a
	print UnixDate(ParseDate("6/1/97 noon EDT"),"%u"),"\n";
Packit 95306a
        => Sun Jun  1 11:00:00 EST 1997
Packit 95306a
Packit 95306a
Date::Manip converts everything to the current time zone (EST in this case).
Packit 95306a
Packit 95306a
Related problems occur when trying to do date calculations over a time zone
Packit 95306a
change.  These calculations may be off by an hour.
Packit 95306a
Packit 95306a
Also, if you are running a script which uses Date::Manip over a period of
Packit 95306a
time which starts in one time zone and ends in another (i.e. it switches
Packit 95306a
form Daylight Saving Time to Standard Time or vice versa), many things may
Packit 95306a
be wrong (especially elapsed time).
Packit 95306a
Packit 95306a
These problems will not be fixed in Date::Manip 5.xx. Date::Manip 6.xx has
Packit 95306a
full support for time zones and daylight saving time.
Packit 95306a
Packit 95306a
=back
Packit 95306a
Packit 95306a
=head1 BUGS AND QUESTIONS
Packit 95306a
Packit 95306a
Please refer to the Date::Manip::Problems documentation for
Packit 95306a
information on submitting bug reports or questions to the author.
Packit 95306a
Packit 95306a
=head1 SEE ALSO
Packit 95306a
Packit 95306a
Date::Manip        - main module documentation
Packit 95306a
Packit 95306a
=head1 LICENSE
Packit 95306a
Packit 95306a
This script is free software; you can redistribute it and/or
Packit 95306a
modify it under the same terms as Perl itself.
Packit 95306a
Packit 95306a
=head1 AUTHOR
Packit 95306a
Packit 95306a
Sullivan Beck (sbeck@cpan.org)
Packit 95306a
Packit 95306a
=cut