This site supports any browser, including Lynx!
Date::Calc Demo: International Eternal Gregorian Calendar
Date::Calc Demo: Simple Date Calculator


Date::Calc
Manual Page


[an error occurred while processing this directive]

See

[search.cpan.org]

for the latest manual page.

Date::Calc

[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)
  • Be computationally complete, i.e., everything should be computable (even if it takes a little more than only one function call)

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 6.2; 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 included in this module usually do not take historical irregularities into account (even though some do in order to show how this can be done),
    they only provide means for calculating regularly recurring events (the profiles should therefore not be relied upon for historical faithfulness)

See also


Last modified: Monday, 18-Nov-2019 15:36:34 CET

[an error occurred while processing this directive]