Date::Manip::Changes5to6 - describes differences between 5.xx and 6.00
| Use Case | Command / Behavior | Description |
|---|---|---|
| Set alternate time zone | Date_Init("SetDate=America/New_York") |
Use SetDate or ForceDate config instead of $::TZ |
| Override config from files | Date_Init("ConfigFile=...", "DateFormat=...") |
List script overrides after config files in Date_Init |
| "today" now midnight | ParseDate("today") โ 00:00:00 |
Use "now" for current time; "today" gives start of day |
| Default time for parsed dates | Date_Init("DefaultTime=curr") |
Controls whether a date without time defaults to 00:00:00 or current time |
| Stricter parsing | "01//03/75" โ no valid date |
Only wellโformed date delimiters accepted; no concatenated words |
| Convert time zones | Date_ConvTZ($date, $from, $to) |
3โargument form only; $from/$to default to local zone |
| Parse Apache log entry | $date->parse_format($line) |
Use OO parse_format instead of old autoโdetection |
| Approximate deltas changed | DateCalc("Jan 10 1996 noon", "Jan 7 1998 noon") |
Result may use mixed signs (+2:0:-0:3:0:0:0) instead of +1:11:4:0:0:0:0 |
Date::Manip 6.00 represents a complete rethink and rewrite of Date::Manip. A great deal of effort was made to make sure that 6.00 is almost backwards compatible with 5.xx whenever feasible, but some functionality has changed in backwards incompatible ways. Other parts have been deprecated and will be removed at some point in the future.
This document describes the differences between the 5.xx series and version 6.00. This page primarily describes technical details, most of which do not impact how Date::Manip is used in scripts. If you want to make sure that a script which ran with 5.xx will run with 6.xx, refer to the Date::Manip::Migration5to6 document.
The Date::Manip 5.xx series suffered from several weaknesses. These included:
Date::Manip 6.00 is a complete rewrite to address these and other issues.
curr_zone_methods.IDLW -1200 International Date Line WestNT -1100 NomeSAT -0400 ChileCLDT -0300 Chile DaylightAT -0200 AzoresMEWT +0100 Middle European WinterMEZ +0100 Middle EuropeanFWT +0100 French WinterGB +0100 GMT with daylight savingSWT +0100 Swedish WinterMESZ +0200 Middle European SummerFST +0200 French SummerMETDST +0200 An alias for MEST used by HPโUXEETDST +0300 An alias for eest used by HPโUXEETEDT +0300 Eastern Europe, USSR Zone 1BT +0300 Baghdad, USSR Zone 2IT +0330 IranZP4 +0400 USSR Zone 3ZP5 +0500 USSR Zone 4IST +0530 Indian StandardZP6 +0600 USSR Zone 5AWST +0800 Australian Western StandardROK +0900 Republic of KoreaAEST +1000 Australian Eastern StandardACDT +1030 Australian Central DaylightCADT +1030 Central Australian DaylightAEDT +1100 Australian Eastern DaylightEADT +1100 Eastern Australian DaylightNZT +1200 New ZealandIDLE +1200 International Date Line Easttzdata script and Date::Manip::TZdata module used to generate these, included for completeness.SetDate or ForceDate config variables.Date_Init are parsed in order, so put configโfile arguments first, then scriptโspecific overrides:
Date_Init("ConfigFile=DateManip.cnf","DateFormat=Other")
Date_Init could return the list of all config variables. That functionality is gone; Date_Init is only for setting variables.GlobalCnf, IgnoreGlobalCnf, PersonalCnf, PersonalCnfPath, and PathSep variables have been removed. Use the single variable ConfigFile with a full path. Multiple config files can be specified:
Date_Init("ConfigFile=./Manip.cnf","ConfigFile=/tmp/Manip.cnf")
TodayIsMidnight โ Use DefaultTimeConvTZ โ Use SetDate or ForceDateInternal โ Use PrintableDeltaSigns โ Use Date::Manip::Delta::printf methodUpdateCurrTZ โ no longer necessaryIntCharSet โ Replaced by Encoding config variableTZ (use SetDate or ForceDate) will be removed in a future version.SetDate and ForceDate now include the old TZ functionality with correct timeโchange handling. Parsed results may differ from 5.x (which is good, because 5.x didn't handle time zones properly).00:00:00). The word "now" still refers to the current date and time.
# 5.xx: "today" = 24 hours from now
# 6.xx: "today" = start of the current day
1996-w02-3 is now interpreted as the 3rd day of the 2nd week (instead of Wednesday of the 2nd week). To get Wednesday (day 3) of that week, use:
$err = $date->parse("1996-w02-1");
$date2 = $date->next(3,1);
"01//03/75" and "in5seconds" will no longer parse (use "01/03/75" and "in 5 seconds"). This simplifies regular expressions and reduces false positives on garbage input.DD/YYmmm, mmmYYYY, etc. are no longer supported. These could be reโadded if requested.DD/mmm/YYYY:HH:MN:SS format is not directly supported, but the parse_format method can parse an Apache log line without preโextracting the date.$timecheck is zero, day 0 is now always defined as the next business day at the same time (previously it was the previous business day). This makes day 0 consistent regardless of $timecheck.DefaultTime config variable. If DefaultTime="curr", any date without time defaults to the current time; otherwise it defaults to midnight.
# With DefaultTime="midnight":
# "Jun 12" -> Jun 12, 2009 at 00:00:00
# "next week" -> Jun 12, 2009 at 00:00:00
%z format now yields -05:00:00 instead of -0500."1 hour 2:3" are no longer supported. Use either a fully numeric (1:2:3) or fully languageโspecific (1 hour 2 minutes 3 seconds) delta.Jan 10 1996 noon and Jan 7 1998 noon is now +2:0:-0:3:0:0:0 (2 years minus 3 days) instead of +1:11:4:0:0:0:0. This matches how most people think about such deltas and is much faster to calculate.Delta_Format command still supports the old format strings (though the new printf method uses a slightly different format). The old formats are not available via printf.-1 for last day of week). Recurrence 1*2:3:4:0:0:0 now means the 3rd occurrence of day 4 (Thursday) in February, not the 3rd occurrence of the 4th day of the week. 1*2:3:-1:0:0:0 is now invalid."every 2nd day in June [1997]" and "every 6th Tuesday [in 1999]" are no longer supported because they are impractical to calculate and break the approximateโdistance model.ParseRecur no longer supplies default dates if the start or end is missing.The Date::Manip module contains the same functions as 5.xx (though the OO modules do all the work now). Changes:
Date_ConvTZ โ Only the 3โargument form is supported: Date_ConvTZ($date, $from, $to). Both $from and $to default to the local time zone. The optional 4th argument ($errlevel) is removed; on error an empty string is returned.DateCalc โ It is no longer recommended to preโparse arguments with ParseDate / ParseDateDelta; the function handles arguments intelligently, and preโparsing would cause double work.Please refer to the Date::Manip::Problems documentation for information on submitting bug reports or questions to the author.
Date::Manip - main module documentation
This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Sullivan Beck (sbeck AT cpan.org)
Generated by phpman v4.9.26-5-g7740029 Author: Che Dong Under GNU General Public License
2026-08-25 17:53 @216.73.217.127
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)