Clone this wiki locally
This FAQ covers the Perl DateTime modules (see http://datetime.perl.org/ for more information). The goal of this FAQ is not to cover date and time issues in general, but just the usage of the DateTime family of modules.
This FAQ is still a work in progress, so there are various items listed as TODO.
If you have questions not covered by the FAQ, please mail them to the mailing list.
Searching the DateTime archives
You can use http://www.google.com/ to search the mailing list archives (seehttp://datetime.perl.org/mailing_list.html). However you need to limit the search to the)http://www.nntp.perl.org/group/perl.datetime/ site.
Why use DateTime?
The DateTime family of modules present a unified way to handle dates and times in Perl. For a good overview of the previous state of Perl's date and time modules see: http://www.perl.com/pub/a/2003/03/13/datetime.html.
The short version is that there are several different packages with overlapping functionality, but it was hard to take dates in one package and convert them to another which you would often have to do to get a function from a different package.
- Large (and growing) collection of alternate calendars to the Gregorian calendar implemented by DateTime. You can freely convert between any of the DateTime::Calendar family modules (including the base DateTime module).
- The internal format of the DateTime module (and most of the other calendars) supports dates far into the past and future to nanosecond accuracy.
- DateTime uses the Olson Time Zone database (http://www.twinsun.com/tz/tz-link.htm to support accurate time zone handling for all time zones in the world.
- DateTime supports UTC (see http://aa.usno.navy.mil/faq/docs/UT.html including leap seconds.
- Powerful family of packages for defining Sets, Spans, Durations and so on. (DateTime::Set, DateTime::Span, DateTime::Duration).
- Growing collection of input and output filters to common formats, a flexible parser generator - DateTime::Format::Builder, and an implementation of strptime - DateTime::Format::Strptime.
- It is slower than some date packages, notable Date::Calc, but DateTime is more correct and featureful.
- Loading many time zones can use up a lot of memory.
Where is calendar X?
If you have looked at and nothing appears relevant try the mailing list. We are still missing some important calendars (Islamic is one big one). Please help by writing one (but check the mailing list first to make sure that no one else has started).