|
|
See |
|
for the latest manual page. |
Date::Calc
What is it for?
Date calculations, e.g.
- "Basic stuff" like leap year, "Julian day" (or "date"), day-of-week, days in month/year, etc.
- Comparing dates
- Conversion from a date (e.g. 01-Jun-2004) to the number of days (e.g. 731733) and vice-versa
- Calculating a date (e.g. 01-Jun-2004) plus/minus a number of days (e.g. +35) yielding a new date (e.g. 06-Jul-2004)
- Calculating the nth day-of-week of a month and year (e.g. the first Tuesday of July 2004 = 06-Jul-2004)
- Calculating differences between dates (and/or times)
- Calculating Easter Sunday and holidays depending on it
- ...
based on
Philosophy
- Toolbox, not a (heavy) ready-made application
- Interoperable, "LEGO system"
- Spirit of UNIX command-line tools (be small, do only one thing, and be good at it)
What it is _NOT_
What it _IS_
- A module _primarily_ for performing _calculations_ with dates (nomen est omen)
- A module intended to be _small_ (low memory footprint) and _fast_ (for heavy-duty applications)
Features
- Extrapolates the Gregorian calendar back beyond 1582 until 1 A.D.
(historically _not_ meaningful, but may nevertheless be useful)
- Numerical range extends as far as "int" data type permits, i.e., at least until the year 32767
- Basic date parsing (input) and formatting (output)
- Support for various languages (input and output)
(Currently 14 as of version 5.4; English, French, German, Spanish, Portuguese, Dutch, Italian, Norwegian, Swedish, Danish, Finnish, Hungarian, Polish and Romanian)
- Calculations on dates, with and without time (including timezone offsets)
- Interface to localtime(), gmtime(), mktime() plus own conversion routines (with more predictable results)
- Internally written in C for smaller memory usage, faster execution and possibility to use in C applications
- The documentation of "Date::Calc" gives model solutions to common problems in its "RECIPES" section
- Optionally provides date objects (i.e., an OO interface) for greater ease of use (Perl only) (Date::Calc::Object)
- Comprises a module for date calculations taking legal holidays into account (Perl only) (Date::Calendar)
- Provides a rich set of holiday profiles for numerous countries (Perl only) (Date::Calendar::Profiles)
Limitations
- The language setting in "Date::Calc" is a global variable (= BEWARE when using threads!)
- The modules "Date::Calendar" and "Date::Calendar::Year" only operate on years between 1583 and 2299
- Uses the ISO-Latin-1 character set, even for languages (such as Polish) not entirely representable in that character set (uses the "plain" characters instead in such cases)
- The calendar profiles usually do not take historical irregularities into account, they only provide means for calculating _regularly_ recurring events (the profiles should therefore not be relied on for historical faithfulness)
See also
|