SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG

 
 

perl-Date-Calc rpm build for : OpenSuSE. For other distributions click perl-Date-Calc.

Name : perl-Date-Calc
Version : 6.4 Vendor : obs://build_opensuse_org/devel:languages:perl
Release : lp156.1.1 Date : 2024-07-03 19:03:42
Group : Development/Libraries/Perl Source RPM : perl-Date-Calc-6.4-lp156.1.1.src.rpm
Size : 0.67 MB
Packager : https://www_suse_com/
Summary : Gregorian calendar date calculations
Description :
* \'use Date::Calc qw( Days_in_Year Days_in_Month ... );\'

* \'use Date::Calc qw(:all);\'

You can either specify the functions you want to import explicitly by
enumerating them between the parentheses of the \"\'qw()\'\" operator, or you
can use the \"\':all\'\" tag instead to import *ALL* available functions.

* \'$days = Days_in_Year($year,$month);\'

This function returns the sum of the number of days in the months starting
with January up to and including \"\'$month\'\" in the given year \"\'$year\'\".

I.e., \"\'Days_in_Year(1998,1)\'\" returns \"\'31\'\", \"\'Days_in_Year(1998,2)\'\"
returns \"\'59\'\", \"\'Days_in_Year(1998,3)\'\" returns \"\'90\'\", and so on.

Note that \"\'Days_in_Year($year,12)\'\" returns the number of days in the
given year \"\'$year\'\", i.e., either \"\'365\'\" or \"\'366\'\".

* \'$days = Days_in_Month($year,$month);\'

This function returns the number of days in the given month \"\'$month\'\" of
the given year \"\'$year\'\".

The year must always be supplied, even though it is only needed when the
month is February, in order to determine whether it is a leap year or not.

I.e., \"\'Days_in_Month(1998,1)\'\" returns \"\'31\'\", \"\'Days_in_Month(1998,2)\'\"
returns \"\'28\'\", \"\'Days_in_Month(2000,2)\'\" returns \"\'29\'\",
\"\'Days_in_Month(1998,3)\'\" returns \"\'31\'\", and so on.

* \'$weeks = Weeks_in_Year($year);\'

This function returns the number of weeks in the given year \"\'$year\'\",
i.e., either \"\'52\'\" or \"\'53\'\".

* \'if (leap_year($year))\'

This function returns \"true\" (\"\'1\'\") if the given year \"\'$year\'\" is a leap
year and \"false\" (\"\'0\'\") otherwise.

* \'if (check_date($year,$month,$day))\'

This function returns \"true\" (\"\'1\'\") if the given three numerical values
\"\'$year\'\", \"\'$month\'\" and \"\'$day\'\" constitute a valid date, and \"false\"
(\"\'0\'\") otherwise.

* \'if (check_time($hour,$min,$sec))\'

This function returns \"true\" (\"\'1\'\") if the given three numerical values
\"\'$hour\'\", \"\'$min\'\" and \"\'$sec\'\" constitute a valid time (\'0 < = $hour <
24\', \'0 < = $min < 60\' and \'0 < = $sec < 60\'), and \"false\" (\"\'0\'\") otherwise.

* \'if (check_business_date($year,$week,$dow))\'

This function returns \"true\" (\"\'1\'\") if the given three numerical values
\"\'$year\'\", \"\'$week\'\" and \"\'$dow\'\" constitute a valid date in business
format, and \"false\" (\"\'0\'\") otherwise.

*Beware* that this function does *NOT* compute whether a given date is a
business day (i.e., Monday to Friday)!

To do so, use \"\'(Day_of_Week($year,$month,$day) < 6)\'\" instead.

* \'$doy = Day_of_Year($year,$month,$day);\'

This function returns the (relative) number of the day of the given date in
the given year.

E.g., \"\'Day_of_Year($year,1,1)\'\" returns \"\'1\'\", \"\'Day_of_Year($year,2,1)\'\"
returns \"\'32\'\", and \"\'Day_of_Year($year,12,31)\'\" returns either \"\'365\'\" or
\"\'366\'\".

The day of year is sometimes also referred to as the Julian day (or date),
although it has nothing to do with the Julian calendar, the calendar which
was used before the Gregorian calendar.

In order to convert the number returned by this function back into a date,
use the function \"\'Add_Delta_Days()\'\" (described further below), as
follows:

$doy = Day_of_Year($year,$month,$day);
($year,$month,$day) = Add_Delta_Days($year,1,1, $doy - 1);

* \'$days = Date_to_Days($year,$month,$day);\'

This function returns the (absolute) number of the day of the given date,
where counting starts at the 1st of January of the year 1 A.D.

I.e., \"\'Date_to_Days(1,1,1)\'\" returns \"\'1\'\", \"\'Date_to_Days(1,12,31)\'\"
returns \"\'365\'\", \"\'Date_to_Days(2,1,1)\'\" returns \"\'366\'\",
\"\'Date_to_Days(1998,5,1)\'\" returns \"\'729510\'\", and so on.

This is sometimes also referred to (not quite correctly) as the Julian date
(or day). This may cause confusion, because also the number of the day in a
year (from 1 to 365 or 366) is frequently called the \"Julian day\".

More confusing still, this has nothing to do with the Julian calendar,
which was used *BEFORE* the Gregorian calendar.

The Julian calendar was named after famous Julius Caesar, who had
instituted it in Roman times. The Julian calendar is less precise than the
Gregorian calendar because it has too many leap years compared to the true
mean length of a year (but the Gregorian calendar also still has one day
too much every 5000 years). Anyway, the Julian calendar was better than
what existed before, because rulers had often changed the calendar used
until then in arbitrary ways, in order to lengthen their own reign, for
instance.

In order to convert the number returned by this function back into a date,
use the function \"\'Add_Delta_Days()\'\" (described further below), as
follows:

$days = Date_to_Days($year,$month,$day);
($year,$month,$day) = Add_Delta_Days(1,1,1, $days - 1);

* \'$dow = Day_of_Week($year,$month,$day);\'

This function returns the number of the day of week of the given date.

The function returns \"\'1\'\" for Monday, \"\'2\'\" for Tuesday and so on until
\"\'7\'\" for Sunday.

Note that in the Hebrew calendar (on which the Christian calendar is
based), the week starts with Sunday and ends with the Sabbath or Saturday
(where according to the Genesis (as described in the Bible) the Lord rested
from creating the world).

In medieval times, Catholic Popes have decreed the Sunday to be the
official day of rest, in order to dissociate the Christian from the Hebrew
belief.

It appears that this actually happened with the Emperor Constantin, who
converted to Christianity but still worshipped the Sun god and therefore
moved the Christian sabbath to the day of the Sun.

Nowadays, the Sunday *AND* the Saturday are commonly considered (and used
as) days of rest, usually referred to as the \"week-end\".

Consistent with this practice, current norms and standards (such as ISO/R
2015-1971, DIN 1355 and ISO 8601) define the Monday as the first day of the
week.

* \'$week = Week_Number($year,$month,$day);\'

This function returns the number of the week the given date lies in.

If the given date lies in the *LAST* week of the *PREVIOUS* year, \"\'0\'\" is
returned.

If the given date lies in the *FIRST* week of the *NEXT* year,
\"\'Weeks_in_Year($year) + 1\'\" is returned.

* \'($week,$year) = Week_of_Year($year,$month,$day);\'

This function returns the number of the week the given date lies in, as
well as the year that week belongs to.

I.e., if the given date lies in the *LAST* week of the *PREVIOUS* year,
\"\'(Weeks_in_Year($year-1), $year-1)\'\" is returned.

If the given date lies in the *FIRST* week of the *NEXT* year, \"\'(1,
$year+1)\'\" is returned.

Otherwise, \"\'(Week_Number($year,$month,$day), $year)\'\" is returned.

* \'$week = Week_of_Year($year,$month,$day);\'

In scalar context, this function returns just the week number. This allows
you to write \"\'$week = Week_of_Year($year,$month,$day);\'\" instead of
\"\'($week) = Week_of_Year($year,$month,$day);\'\" (note the parentheses around
\"\'$week\'\").

If the given date lies in the *LAST* week of the *PREVIOUS* year,
\"\'Weeks_in_Year($year-1)\'\" is returned.

If the given date lies in the *FIRST* week of the *NEXT* year, \"\'1\'\" is
returned.

Otherwise the return value is identical with that of
\"\'Week_Number($year,$month,$day)\'\".

*BEWARE* that using this function in scalar context is a *DANGEROUS*
feature, because without knowing which year the week belongs to, you might
inadvertently assume the wrong one!

If for instance you are iterating through an interval of dates, you might
assume that the week always belongs to the same year as the given date,
which unfortunately is *WRONG* in some cases!

In many years, the 31st of December for instance belongs to week number one
of the *FOLLOWING* year. Assuming that the year is the same as your date
(31st of December, in this example), sends you back to the first week of
the *CURRENT* year - the Monday of which, by the way, in case of bad luck,
might actually lie in the year *BEFORE* the current year!

This actually happens in 2002, for example.

So you always need to provide the correct corresponding year number by
other means, keeping track of it yourself.

In case you do not understand this, never mind, but then simply *DO NOT
USE* this function in scalar context!

* \'($year,$month,$day) = Monday_of_Week($week,$year);\'

This function returns the date of the first day of the given week, i.e.,
the Monday.

\"\'$year\'\" must be greater than or equal to \"\'1\'\", and \"\'$week\'\" must lie in
the range \"\'1\'\" to \"\'Weeks_in_Year($year)\'\".

Note that you can write \"\'($year,$month,$day) =
Monday_of_Week(Week_of_Year($year,$month,$day));\'\" in order to calculate
the date of the Monday of the same week as the given date.

If you want to calculate any other day of week in the same week as a given
date, use

AATTdate = Add_Delta_Days(Monday_of_Week(Week_of_Year(AATTdate)),$offset);

where \'$offset = 1\' for Tuesday, \'2\' for Wednesday etc.

* \'if (($year,$month,$day) =
Nth_Weekday_of_Month_Year($year,$month,$dow,$n))\'

This function calculates the date of the \"\'$n\'\"th day of week \"\'$dow\'\" in
the given month \"\'$month\'\" and year \"\'$year\'\"; such as, for example, the
3rd Thursday of a given month and year.

This can be used to send a notification mail to the members of a group
which meets regularly on every 3rd Thursday of a month, for instance.

(See the section \"RECIPES\" near the end of this document for a code snippet
to actually do so.)

\"\'$year\'\" must be greater than or equal to \"\'1\'\", \"\'$month\'\" must lie in
the range \"\'1\'\" to \"\'12\'\", \"\'$dow\'\" must lie in the range \"\'1\'\" to \"\'7\'\"
and \"\'$n\'\" must lie in the range \"\'1\'\" to \"\'5\'\", or a fatal error (with
appropriate error message) occurs.

The function returns an empty list when the 5th of a given day of week does
not exist in the given month and year.

* \'($year,$week,$dow) = Standard_to_Business($year,$month,$day);\'

This function converts a given date from standard notation (year, month,
day (of month)) to business notation (year, week, day of week).

* \'($year,$month,$day) = Business_to_Standard($year,$week,$dow);\'

This function converts a given date from business notation (year, week, day
of week) to standard notation (year, month, day (of month)).

* \'$Dd = Delta_Days($year1,$month1,$day1, $year2,$month2,$day2);\'

This function returns the difference in days between the two given dates.

The result is positive if the two dates are in chronological order, i.e.,
if date #1 comes chronologically *BEFORE* date #2, and negative if the
order of the two dates is reversed.

The result is zero if the two dates are identical.

* \'($Dd,$Dh,$Dm,$Ds) = Delta_DHMS($year1,$month1,$day1, $hour1,$min1,$sec1,
$year2,$month2,$day2, $hour2,$min2,$sec2);\'

This function returns the difference in days, hours, minutes and seconds
between the two given dates with times.

All four return values will be positive if the two dates are in
chronological order, i.e., if date #1 comes chronologically *BEFORE* date

is reversed.

This is so that the two functions \"\'Delta_DHMS()\'\" and \"\'Add_Delta_DHMS()\'\"
(description see further below) are complementary, i.e., mutually inverse:

Add_Delta_DHMS(AATTdate1,AATTtime1, Delta_DHMS(AATTdate1,AATTtime1, AATTdate2,AATTtime2))

yields \"\'(AATTdate2,AATTtime2)\'\" again, whereas

Add_Delta_DHMS(AATTdate2,AATTtime2,
map(-$_, Delta_DHMS(AATTdate1,AATTtime1, AATTdate2,AATTtime2)))

yields \"\'(AATTdate1,AATTtime1)\'\", and

Delta_DHMS(AATTdate1,AATTtime1, Add_Delta_DHMS(AATTdate1,AATTtime1, AATTdelta))

yields \"\'AATTdelta\'\" again.

The result is zero (in all four return values) if the two dates and times
are identical.

* \'($Dy,$Dm,$Dd) = Delta_YMD($year1,$month1,$day1, $year2,$month2,$day2);\'

This function returns the vector

( $year2 - $year1, $month2 - $month1, $day2 - $day1 )

This is called the \"one-by-one\" semantics.

Adding the result of this function to the first date always yields the
second date again, and adding the negative result (where the signs of all
elements of the result vector have been flipped) to the second date gives
the first date. See also the description of the function \"Add_Delta_YMD()\"
further below.

Example:

(6,2,-30) == Delta_YMD(1996,1,31, 2002,3,1]);

[1996,1,31] + ( 6, 2,-30) = [2002,3, 1]
[2002,3, 1] + (-6,-2, 30) = [1996,1,31]

An error occurs if any of the two given dates is invalid.

* \'($D_y,$D_m,$D_d, $Dh,$Dm,$Ds) = Delta_YMDHMS($year1,$month1,$day1,
$hour1,$min1,$sec1, $year2,$month2,$day2, $hour2,$min2,$sec2);\'

This function is based on the function \"Delta_YMD()\" above but additionally
calculates the time difference. When a carry over from the time difference
occurs, the value of \"\'$D_d\'\" is adjusted accordingly, thus giving the
correct total date/time difference.

Arguments are expected to be in chronological order to yield a (usually)
positive result.

In any case, adding the result of this function to the first date/time
value (\'$year1,$month1,$day1,\' \'$hour1,$min1,$sec1\') always gives the
second date/time value (\'$year2,$month2,$day2,\' \'$hour2,$min2,$sec2\')
again, and adding the negative result (with the signs of all elements of
the result vector flipped) to the second date/time value gives the first
date/time value.

See the function \"Add_Delta_YMDHMS()\" further below for adding a date/time
value and a date/time difference.

An error occurs if any of the given two date/time values is invalid.

* \'($Dy,$Dm,$Dd) = N_Delta_YMD($year1,$month1,$day1, $year2,$month2,$day2);\'

This function returns the difference between the two given dates in a more
intuitive way (as far as possible - more on that see a bit further below)
than the function \"Delta_YMD()\" described above.

The \"N\" which precedes its name is meant to signify \"new\" or \"normalized\".

This function is loosely based on recipe #17 b) (see the section \"RECIPES\"
below near the end of this document).

However, the code of recipe #17 b) actually does not treat positive and
negative values symmetrically and consistently.

This new routine does.

The return values of this function are guaranteed to all have the same sign
(or to be zero). This is why this function is called \"normalized\".

Moreover, the results are guaranteed to be \"minimal\", in the sense that
\'|$Dm| < 12\' and \'|$Dd| < 31\' (which is equivalent to \'$Dm\' lying in the
range \'[-11..+11]\' and \'$Dd\' lying in the range \'[-30..+30]\').

When the results are applied (i.e., added) to the first given date in a
left-to-right order, the second given date is guaranteed to be obtained,
provided that intermediary results are truncated, as done by the function
\"Add_Delta_YM()\" (see further below), i.e., that invalid intermediate dates
such as e.g. [2009,2,31] will automatically be transformed into [2009,2,28]
(and not \"wrapped\" into the next month, e.g. to [2009,3,3]).

This is called the \"left-to-right with truncation\" semantics.

Note that reversing the order of the given dates and reversing the sign of
each of the result values will not always add up.

Consider the dates [2008,2,29] and [2009,2,1]: their difference is (0,11,3)
([2008,2,29] plus 11 months is [2009,1,29], which plus 3 days is
[2009,2,1]), but the difference between [2009,2,1] and [2008,2,29] is
(0,-11,-1), and not (0,-11,-3) ([2009,2,1] minus 11 months is [2008,3,1],
which minus one day is [2008,2,29]).

Another example: The difference between [1996,2,29] and [1997,2,28] is
(1,0,0) (observe the truncation of the invalid date [1997,2,29] to
[1997,2,28] here!), whereas the difference between [1997,2,28] and
[1996,2,29] is (0,-11,-28) ([1997,2,28] minus 11 months is [1996,3,28],
which minus 28 days is not [1996,3,0] but of course [1996,2,29]).

\"Benign\" examples such as for instance the difference between [1964,1,3]
and [2009,9,10] are completely symmetrical: The difference in this example
is (45,8,7), whereas the difference between [2009,9,10] and [1964,1,3] is
(-45,-8,-7), as would normally be expected. In this example, the result is
also the same as the one returned by \"Delta_YMD()\".

All these counter-intuitive effects are due to the fact that months (and
due to leap years, also years) do not correspond to a fixed number of days,
so the semantics of \"plus one month\" or \"plus one year\" are in fact
undefined.

The present function is an attempt to provide a definition which is
intuitive most of the time, and at least consistent the rest of the time.

Other definitions are of course possible, but most often lead to
contradictions (e.g., the results and the given first date do not add up to
the second given date).

See the file \"datecalc.pl\" in the \"examples\" subdirectory of this
distribution for a way to play around with this function, or go to
http://www.engelschall.com/u/sb/datecalc/ for the online version.

An error occurs if any of the two given dates is invalid, or if any
intermediate result leads to an invalid date (this does not apply to
truncation, however, as explained above).

* \'($D_y,$D_m,$D_d, $Dhh,$Dmm,$Dss) = N_Delta_YMDHMS($year1,$month1,$day1,
$hour1,$min1,$sec1, $year2,$month2,$day2, $hour2,$min2,$sec2);\'

This function essentially does the same as the function \"N_Delta_YMD()\"
described immediately above, except that also the difference in hours,
minutes and seconds is taken into account.

This function is loosely based on recipe #17 a) (see the section \"RECIPES\"
below near the end of this document).

However, the code of recipe #17 a) actually does not treat positive and
negative values symmetrically and consistently.

This new routine does.

The return values of this function (including the time differences) are
guaranteed to all have the same sign (or to be zero). This is the reason
for the \"N\" that precedes the name of this function, which is intended to
mean \"normalized\" (or \"new\").

Moreover, the results are guaranteed to be \"minimal\", in the sense that
\'|$D_m| < 12\', \'|$D_d| < 31\', \'|$Dhh| < 24\', \'|$Dmm| < 60\' and \'|$Dss| <
60\' (which is equivalent to \'$D_m\' lying in the range \'[-11..+11]\', \'$D_d\'
lying in the range \'[-30..+30]\', \'$Dhh\' lying in the range \'[-23..+23]\',
and \'$Dmm\' and \'$Dss\' both lying in the range \'[-59..+59]\').

* \'($Dd,$Dh,$Dm,$Ds) = Normalize_DHMS($Dd,$Dh,$Dm,$Ds);\'

This function takes four arbitrary values for days, hours, minutes and
seconds (which may have different signs) and renormalizes them so that the
values for hours, minutes and seconds will lie in the ranges \'[-23..23]\',
\'[-59..59]\' and \'[-59..59]\', respectively, and so that all four values have
the same sign (or are zero).

The given values are left untouched, i.e., unchanged.

* \'($year,$month,$day) = Add_Delta_Days($year,$month,$day, $Dd);\'

This function has two principal uses:

First, it can be used to calculate a new date, given an initial date and an
offset (which may be positive or negative) in days, in order to answer
questions like \"today plus 90 days -- which date gives that?\".

(In order to add a weeks offset, simply multiply the weeks offset with
\"\'7\'\" and use that as your days offset.)

Second, it can be used to convert the canonical representation of a date,
i.e., the number of that day (where counting starts at the 1st of January
in 1 A.D.), back into a date given as year, month and day.

Because counting starts at \"\'1\'\", you will actually have to subtract \"\'1\'\"
from the canonical date in order to get back the original date:

$canonical = Date_to_Days($year,$month,$day);

($year,$month,$day) = Add_Delta_Days(1,1,1, $canonical - 1);

Moreover, this function is the inverse of the function \"\'Delta_Days()\'\":

Add_Delta_Days(AATTdate1, Delta_Days(AATTdate1, AATTdate2))

yields \"\'AATTdate2\'\" again, whereas

Add_Delta_Days(AATTdate2, -Delta_Days(AATTdate1, AATTdate2))

yields \"\'AATTdate1\'\", and

Delta_Days(AATTdate1, Add_Delta_Days(AATTdate1, $delta))

yields \"\'$delta\'\" again.

* \'($year,$month,$day, $hour,$min,$sec) = Add_Delta_DHMS($year,$month,$day,
$hour,$min,$sec, $Dd,$Dh,$Dm,$Ds);\'

This function serves to add a days, hours, minutes and seconds offset to a
given date and time, in order to answer questions like \"today and now plus
7 days but minus 5 hours and then plus 30 minutes, what date and time gives
that?\":

($y,$m,$d,$H,$M,$S) = Add_Delta_DHMS(Today_and_Now(), +7,-5,+30,0);

* \'($year,$month,$day) = Add_Delta_YM($year,$month,$day, $Dy,$Dm);\'

This function can be used to add a year and/or month offset to a given
date.

In contrast to the function described immediately below
(\"\'Add_Delta_YMD()\'\"), this function does no \"wrapping\" into the next month
if the day happens to lie outside the valid range for the resulting year
and month (after adding the year and month offsets). Instead, it simply
truncates the day to the last possible day of the resulting month.

Examples:

Adding an offset of 0 years, 1 month to the date [1999,1,31] would result
in the (invalid) date [1999,2,31]. The function replaces this result by the
(valid) date [1999,2,28].

Adding an offset of 1 year, 1 month to the same date [1999,1,31] as above
would result in the (still invalid) date [2000,2,31]. The function replaces
this result by the valid date [2000,2,29] (because 2000 is a leap year).

Note that the year and month offsets can be negative, and that they can
have different signs.

If you want to additionally add a days offset, use the function
\"\'Add_Delta_Days()\'\" before or after calling \"\'Add_Delta_YM()\'\":

AATTdate2 = Add_Delta_Days( Add_Delta_YM(AATTdate1, $Dy,$Dm), $Dd );
AATTdate2 = Add_Delta_YM( Add_Delta_Days(AATTdate1, $Dd), $Dy,$Dm );

Note that your result may depend on the order in which you call these two
functions!

Consider the date [1999,2,28] and the offsets 0 years, 1 month and 1 day:

[1999,2,28] plus one month is [1999,3,28], plus one day is [1999,3,29].
[1999,2,28] plus one day is [1999,3,1], plus one month is [1999,4,1].

(Which is also the reason why the \"\'Add_Delta_YM()\'\" function does not
allow to add a days offset, because this would actually require TWO
functions: One for adding the days offset BEFORE and one for adding it
AFTER applying the year/month offsets.)

An error occurs if the initial date is not valid.

Note that \"\'Add_Delta_YM( Add_Delta_YM(AATTdate, $Dy,$Dm), -$Dy,-$Dm );\'\" will
not, in general, return the original date \"\'AATTdate\'\" (consider the examples
given above!).

* \'($year,$month,$day) = Add_Delta_YMD($year,$month,$day, $Dy,$Dm,$Dd);\'

This function serves to add a years, months and days offset to a given
date.

(In order to add a weeks offset, simply multiply the weeks offset with
\"\'7\'\" and add this number to your days offset.)

Note that the three offsets for years, months and days are applied
independently from each other. This also allows them to have different
signs.

The years and months offsets are applied first, and the days offset is
applied last.

If the resulting date happens to fall on a day after the end of the
resulting month, like the 32nd of April or the 30th of February, then the
date is simply counted forward into the next month (possibly also into the
next year) by the number of excessive days (e.g., the 32nd of April will
become the 2nd of May).

*BEWARE* that this behaviour differs from that of previous versions of this
module! In previous versions, the day was simply truncated to the maximum
number of days in the resulting month.

If you want the previous behaviour, use the new function \"\'Add_Delta_YM()\'\"
(described immediately above) plus the function \"\'Add_Delta_Days()\'\"
instead.

*BEWARE* also that because a year and a month offset is not equivalent to a
fixed number of days, the transformation performed by this function is *NOT
ALWAYS REVERSIBLE*!

This is in contrast to the functions \"\'Add_Delta_Days()\'\" and
\"\'Add_Delta_DHMS()\'\", which are fully and truly reversible (with the help
of the functions \"\'Delta_Days()\'\" and \"\'Delta_DHMS()\'\", for instance).

Note that for this same reason,

AATTdate = Add_Delta_YMD(
Add_Delta_YMD(AATTdate, $Dy,$Dm,$Dd), -$Dy,-$Dm,-$Dd);

will in general *NOT* return the initial date \"\'AATTdate\'\", even though

AATTdate2 = Add_Delta_YMD( AATTdate1, Delta_YMD(AATTdate1, AATTdate2) );

will always return the second date \"\'AATTdate2\'\", and

AATTdate1 = Add_Delta_YMD( AATTdate2, map(-$_, Delta_YMD(AATTdate1, AATTdate2)) );

which is the same as

AATTdate1 = Add_Delta_YMD( AATTdate2, Delta_YMD(AATTdate2, AATTdate1) );

will always return the first date \"\'AATTdate1\'\".

Examples:

[1996,1,31] + ( 6, 1,-2) = [2002,3,1]
[2002,3, 1] + (-6,-1, 2) = [1996,2,3] # EXPECTED: [1996,1,31]

(6,2,-30) == Delta_YMD(1996,1,31, 2002,3,1);

[1996,1,31] + ( 6, 2,-30) = [2002,3, 1]
[2002,3, 1] + (-6,-2, 30) = [1996,1,31] # OK

(6,1,-2) == Delta_YMD(1996,2,3, 2002,3,1);

[1996,2,3] + ( 6, 1,-2) = [2002,3,1]
[2002,3,1] + (-6,-1, 2) = [1996,2,3] # OK

Note that this is *NOT* a program bug but *NECESSARILY* so, because of the
variable lengths of years and months, and hence because of the ambiguity of
the difference between two dates in terms of years, months and days, i.e.,
the fact that the difference between two dates can be expressed in more
than one way:

[1996,1,31] + (6,1, -2) = [2002,3,1]
[1996,1,31] + (6,2,-30) = [2002,3,1]

* \'($year,$month,$day, $hour,$min,$sec) = Add_Delta_YMDHMS($year,$month,$day,
$hour,$min,$sec, $D_y,$D_m,$D_d, $Dh,$Dm,$Ds);\'

Same as the function above, except that a time offset may be given in
addition to the year, month and day offset.

* \'($year,$month,$day) = Add_N_Delta_YMD($year,$month,$day, $Dy,$Dm,$Dd);\'

This function is actually a shortcut for applying the function
\"Add_Delta_YM()\" first, followed by the function \"Add_Delta_Days()\", i.e.,
this function does exactly the same as

($year,$month,$day) = Add_Delta_Days( Add_Delta_YM($year,$month,$day,$Dy,$Dm), $Dd );

Beware that, if necessary, the function \"Add_Delta_YM()\" truncates the
resulting day of the month to the largest allowable value for that month,
i.e., the (invalid) result [2009,2,31] is automatically transformed into
[2009,2,28].

For more details on this truncation, see the description of the function
\"Add_Delta_YM()\" further above.

This function is meant to be complementary with the function
\"N_Delta_YMD()\" described further above.

This means that it is guaranteed that the result returned by

Add_N_Delta_YMD( AATTdate1, N_Delta_YMD(AATTdate1, AATTdate2) );

is always identical with the given date \"\'AATTdate2\'\".

Note however that unlike with function \"Add_Delta_YMD()\", the reverse is
not true here, i.e.,

($Dy,$Dm,$Dd) = N_Delta_YMD(AATTdate1,AATTdate2);
AATTdate = Add_N_Delta_YMD(AATTdate2, -$Dy,-$Dm,-$Dd);

will *NOT* always return the initial date \"\'AATTdate1\'\".

Example:

(0,11,3) == N_Delta_YMD(2008,2,29, 2009,2,1);

[2008,2,29] + (0, 11, 3) = [2009,2, 1]
[2009,2, 1] + (0,-11,-3) = [2008,2,27] # EXPECTED: [2008,2,29]

* \'($year,$month,$day, $hour,$min,$sec) =
Add_N_Delta_YMDHMS($year,$month,$day, $hour,$min,$sec, $D_y,$D_m,$D_d,
$Dhh,$Dmm,$Dss);\'

This function essentially does the same as the function \"Add_N_Delta_YMD()\"
described immediately above, except that also the difference in hours,
minutes and seconds is taken into account.

* \'($year,$month,$day, $hour,$min,$sec, $doy,$dow,$dst) =
System_Clock([$gmt]);\'

If your operating system supports the corresponding system calls
(\"\'time()\'\" and \"\'localtime()\'\" or \"\'gmtime()\'\"), this function will return
the information provided by your system clock, i.e., the current date and
time, the number of the day of year, the number of the day of week and a
flag signaling whether daylight savings time is currently in effect or not.

The ranges of values returned (and their meanings) are as follows:

$year : 1970..2038 (or more) [Unix etc.]
$year : 1904..2040 [MacOS Classic]

$month : 1..12
$day : 1..31
$hour : 0..23
$min : 0..59
$sec : 0..59 (0..61 on some systems)
$doy : 1..366
$dow : 1..7
$dst : -1..1

\"\'$doy\'\" is the day of year, sometimes also referred to as the \"julian
date\", which starts at \"\'1\'\" and goes up to the number of days in that
year.

The day of week (\"\'$dow\'\") will be \"\'1\'\" for Monday, \"\'2\'\" for Tuesday and
so on until \"\'7\'\" for Sunday.

The daylight savings time flag (\"\'$dst\'\") will be \"\'-1\'\" if this
information is not available on your system, \"\'0\'\" for no daylight savings
time (i.e., winter time) and \"\'1\'\" when daylight savings time is in effect.

If your operating system does not provide the necessary system calls,
calling this function will result in a fatal \"not available on this system\"
error message.

If you want to handle this exception yourself, use \"\'eval\'\" as follows:

eval { ($year,$month,$day, $hour,$min,$sec, $doy,$dow,$dst) =
System_Clock(); };

if ($AATT)
{


}

Note that curlies (\"{\" and \"}\") are used here to delimit the statement to
be \"eval\"ed (which is the way to catch exceptions in Perl), and not quotes
(which is a way to evaluate Perl expressions at runtime).

If the optional (boolean) input parameter \"\'$gmt\'\" is given, a \"true\" value
(\"\'1\'\") will cause \"\'gmtime()\'\" to be used instead of \"\'localtime()\'\",
internally, thus returning Greenwich Mean Time (GMT, or UTC) instead of
local time.

* \'($year,$month,$day) = Today([$gmt]);\'

This function returns a subset of the values returned by the function
\"\'System_Clock()\'\" (see above for details), namely the current year, month
and day.

A fatal \"not available on this system\" error message will appear if the
corresponding system calls are not supported by your current operating
system.

If the optional (boolean) input parameter \"\'$gmt\'\" is given, a \"true\" value
(\"\'1\'\") will cause \"\'gmtime()\'\" to be used instead of \"\'localtime()\'\",
internally, thus returning Greenwich Mean Time (GMT, or UTC) instead of
local time.

* \'($hour,$min,$sec) = Now([$gmt]);\'

This function returns a subset of the values returned by the function
\"\'System_Clock()\'\" (see above for details), namely the current time (hours,
minutes and full seconds).

A fatal \"not available on this system\" error message will appear if the
corresponding system calls are not supported by your current operating
system.

If the optional (boolean) input parameter \"\'$gmt\'\" is given, a \"true\" value
(\"\'1\'\") will cause \"\'gmtime()\'\" to be used instead of \"\'localtime()\'\",
internally, thus returning Greenwich Mean Time (GMT, or UTC) instead of
local time.

* \'($year,$month,$day, $hour,$min,$sec) = Today_and_Now([$gmt]);\'

This function returns a subset of the values returned by the function
\"\'System_Clock()\'\" (see above for details), namely the current date (year,
month, day) and time (hours, minutes and full seconds).

A fatal \"not available on this system\" error message will appear if the
corresponding system calls are not supported by your current operating
system.

If the optional (boolean) input parameter \"\'$gmt\'\" is given, a \"true\" value
(\"\'1\'\") will cause \"\'gmtime()\'\" to be used instead of \"\'localtime()\'\",
internally, thus returning Greenwich Mean Time (GMT, or UTC) instead of
local time.

* \'$year = This_Year([$gmt]);\'

This function returns the current year, according to local time.

A fatal \"not available on this system\" error message will appear if the
corresponding system calls are not supported by your current operating
system.

If the optional (boolean) input parameter \"\'$gmt\'\" is given, a \"true\" value
(\"\'1\'\") will cause \"\'gmtime()\'\" to be used instead of \"\'localtime()\'\",
internally, thus returning Greenwich Mean Time (GMT, or UTC) instead of
local time. However, this will only make a difference within a few hours
around New Year (unless you are on a Pacific island, where this can be
almost 24 hours).

* \'($year,$month,$day, $hour,$min,$sec, $doy,$dow,$dst) = Gmtime([time]);\'

This is Date::Calc\'s equivalent of Perl\'s built-in \"gmtime()\" function. See
also perlfunc(1)/gmtime.

With the optional argument \"time\" (i.e., seconds since the epoch), this
function will return the corresponding values for that particular time
(instead of the current time when this parameter is omitted).

The ranges of values returned (and their meanings) are as follows:

$year : 1970..2038 (or more) [Unix etc.]
$year : 1904..2040 [MacOS Classic]

$month : 1..12
$day : 1..31
$hour : 0..23
$min : 0..59
$sec : 0..59
$doy : 1..366
$dow : 1..7
$dst : -1..1

\"\'$doy\'\" is the day of year, sometimes also referred to as the \"julian
date\", which starts at \"\'1\'\" and goes up to the number of days in that
year.

The day of week (\"\'$dow\'\") will be \"\'1\'\" for Monday, \"\'2\'\" for Tuesday and
so on until \"\'7\'\" for Sunday.

The daylight savings time flag (\"\'$dst\'\") will be \"\'-1\'\" if this
information is not available on your system, \"\'0\'\" for no daylight savings
time (i.e., winter time) and \"\'1\'\" when daylight savings time is in effect.

A fatal \"time out of range\" error will occur if the given time value is out
of range \'[0..(~0>>1)]\'.

If the time value is omitted, the \"time()\" function is called instead,
internally.

* \'($year,$month,$day, $hour,$min,$sec, $doy,$dow,$dst) = Localtime([time]);\'

This is Date::Calc\'s equivalent of Perl\'s built-in \"localtime()\" function.
See also perlfunc(1)/localtime.

The ranges of values returned (and their meanings) are as follows:

$year : 1970..2038 (or more) [Unix etc.]
$year : 1904..2040 [MacOS Classic]

$month : 1..12
$day : 1..31
$hour : 0..23
$min : 0..59
$sec : 0..59
$doy : 1..366
$dow : 1..7
$dst : -1..1

\"\'$doy\'\" is the day of year, sometimes also referred to as the \"julian
date\", which starts at \"\'1\'\" and goes up to the number of days in that
year.

The day of week (\"\'$dow\'\") will be \"\'1\'\" for Monday, \"\'2\'\" for Tuesday and
so on until \"\'7\'\" for Sunday.

The daylight savings time flag (\"\'$dst\'\") will be \"\'-1\'\" if this
information is not available on your system, \"\'0\'\" for no daylight savings
time (i.e., winter time) and \"\'1\'\" when daylight savings time is in effect.

A fatal \"time out of range\" error will occur if the given time value is out
of range \'[0..(~0>>1)]\'.

If the time value is omitted, the \"time()\" function is called instead,
internally.

* \'$time = Mktime($year,$month,$day, $hour,$min,$sec);\'

This function converts a date into a time value, i.e., into the number of
seconds since whatever moment in time your system considers to be the
\"epoch\". On Unix and most other systems this is the number of seconds since
January 1st 1970 at midnight (GMT). On MacOS Classic this is the number of
seconds since January 1st 1904 at midnight (local time).

The function is similar to the \"POSIX::mktime()\" function (see
POSIX(1)/mktime for more details), but in contrast to the latter, it
expects dates in the usual ranges used throughout this module: The year
2001 stays year 2001, and months are numbered from 1 to 12.

A fatal \"date out of range\" error will occur if the given date cannot be
expressed in terms of seconds since the epoch (this happens for instance
when the date lies before the epoch, or if it is later than 19-Jan-2038
03:14:07 GMT on 32 bit Unix systems, or later than 06-Feb-2040 06:28:15
(local time) on a Macintosh with MacOS Classic).

Just like the \"POSIX::mktime()\" function, this function uses the \"mktime()\"
system call, internally.

This means that the given date and time is considered to be in local time,
and that the value returned by this function will depend on your machine\'s
local settings such as the time zone, whether daylight savings time is (or
was, at the time) in effect, and the system clock itself.

*BEWARE* that \"mktime()\" does not always return the same time value as fed
into \"localtime()\", when you feed the output of \"localtime()\" back into
\"mktime()\", on some systems!

I.e., \"\'Mktime((Localtime($time))[0..5])\'\" will not always return the same
value as given in \"\'$time\'\"!

* \'($D_y,$D_m,$D_d, $Dh,$Dm,$Ds, $dst) = Timezone([time]);\'

This function returns the difference between \"\'localtime(time)\'\" and
\"\'gmtime(time)\'\", which is the timezone offset in effect for the current
location and the given \"\'time\'\".

This offset is positive if you are located to the east of Greenwich, and is
usually negative (except during daylight savings time, in some locations)
if you are located to the west of Greenwich.

Note that this offset is influenced by all of the relevant system settings
and parameters on your machine; such as locales, environment variables
(e.g. \"\'TZ\'\") and the system clock itself. See the relevant documentation
on your system for more details.

If the \"\'time\'\" is omitted, the \"\'time()\'\" function will be called
automatically, internally (similar to the built-in functions
\"\'localtime()\'\" and \"\'gmtime()\'\" in Perl).

A fatal \"time out of range\" error will occur if the given time value is out
of range \'[0..(~0>>1)]\'.

The last item of the returned list is a flag which indicates whether
daylight savings time is currently in effect. This flag is negative (-1) if
this information is not available on your system. It is zero (0) when
daylight savings time is off, and positive (+1) when daylight savings time
is on.

Thus you can check very quickly whether daylight savings time is currently
in effect by evaluating this function in scalar context (in scalar context,
Perl returns the last item of a list):

if (scalar Timezone > 0) { # yes, daylight savings time

However, a slightly more efficient way would be this:

if (scalar System_Clock > 0) { # yes, daylight savings time

* \'$time = Date_to_Time($year,$month,$day, $hour,$min,$sec);\'

This function is a replacement for the BSD function \"timegm()\" (which is
not available on all Unix systems), which converts a given date and time
into a time value, i.e., into the number of seconds since whatever moment
in time your system considers to be the \"epoch\". On Unix and most other
systems this is the number of seconds since January 1st 1970 at midnight
(GMT). On MacOS Classic this is the number of seconds since January 1st
1904 at midnight (local time).

Under Unix, the date and time are considered to be in UTC (\"Universal Time
Coordinated\", and so is the resulting time value.

UTC is almost the same as GMT (or \"Greenwich Mean Time\"), except that UTC
has leap seconds (in order to account for small variations in the rotation
of the earth, for instance), whereas GMT does not.

Under MacOS Classic, however, both input and output are considered to be in
local time.

The ranges of year and month follow the same rules as throughout the rest
of this module (and not the contorted rules of its Unix equivalent), i.e.,
the year \"2001\" stays \"2001\" and the month ranges from 1 to 12.

A fatal \"date out of range\" error will occur if the given date cannot be
expressed in terms of seconds since the epoch (this happens for instance
when the date lies before the epoch, or if it is later than 19-Jan-2038
03:14:07 GMT on 32 bit Unix systems, or later than 06-Feb-2040 06:28:15
(local time) on a Macintosh with MacOS Classic).

This function should be very fast, because it is implemented in a very
straightforward manner and doesn\'t use any internal system calls.

Moreover, the functions \"Date_to_Time()\" and \"Time_to_Date()\" are
guaranteed to be complementary, i.e., that
\"\'Date_to_Time(Time_to_Date($time))\'\" and
\"\'Time_to_Date(Date_to_Time($year,$month,$day, $hour,$min,$sec))\'\" will
always return the initial values.

* \'($year,$month,$day, $hour,$min,$sec) = Time_to_Date([time]);\'

This function is an alternative to the POSIX \"gmtime()\" function (and its
built-in Perl equivalent), which converts a given time value into the
corresponding date and time. The given time value must be the number of
seconds since whatever moment in time your system considers to be the
\"epoch\". On Unix and most other systems this is the number of seconds since
January 1st 1970 at midnight (GMT). On MacOS Classic this is the number of
seconds since January 1st 1904 at midnight (local time).

Under Unix, the given time value is considered to be in UTC (\"Universal
Time Coordinated\", and so is the resulting date and time.

UTC is almost the same as GMT (or \"Greenwich Mean Time\"), except that UTC
has leap seconds (in order to account for small variations in the rotation
of the earth, for instance), whereas GMT does not.

Under MacOS Classic, however, both input and output are considered to be in
local time.

If the input value \"\'time\'\" is omitted, the \"\'time()\'\" function will be
called automatically, internally (similar to the built-in functions
\"\'localtime()\'\" and \"\'gmtime()\'\" in Perl).

A fatal \"time out of range\" error will occur if the given time value is
negative.

This function should be very fast, because it is implemented in a very
straightforward manner and doesn\'t use any internal system calls (except
for \"time()\", if the input value is omitted).

Moreover, the functions \"Date_to_Time()\" and \"Time_to_Date()\" are
guaranteed to be complementary, i.e., that
\"\'Date_to_Time(Time_to_Date($time))\'\" and
\"\'Time_to_Date(Date_to_Time($year,$month,$day, $hour,$min,$sec))\'\" will
always return the initial values.

* \'($year,$month,$day) = Easter_Sunday($year);\'

This function calculates the date of Easter Sunday for all years in the
range from 1583 to 2299 (all other year numbers will result in a fatal
\"year out of range\" error message) using the method known as the \"Gaussian
Rule\".

Some related christian feast days which depend on the date of Easter
Sunday:

Carnival Monday / Rosenmontag / Veille du Mardi Gras = -48 days
Mardi Gras / Karnevalsdienstag / Mardi Gras = -47 days
Ash Wednesday / Aschermittwoch / Mercredi des Cendres = -46 days
Palm Sunday / Palmsonntag / Dimanche des Rameaux = -7 days
Easter Friday / Karfreitag / Vendredi Saint = -2 days
Easter Saturday / Ostersamstag / Samedi de Paques = -1 day
Easter Monday / Ostermontag / Lundi de Paques = +1 day
Ascension of Christ / Christi Himmelfahrt / Ascension = +39 days
Whitsunday / Pfingstsonntag / Dimanche de Pentecote = +49 days
Whitmonday / Pfingstmontag / Lundi de Pentecote = +50 days
Feast of Corpus Christi / Fronleichnam / Fete-Dieu = +60 days

Use the offsets shown above to calculate the date of the corresponding
feast day as follows:

($year,$month,$day) = Add_Delta_Days(Easter_Sunday($year), $offset));

* \'if ($month = Decode_Month($string[,$lang]))\'

This function takes a string as its argument, which should contain the name
of a month in the given or currently selected language (see further below
for details about the multi-language support of this package), or any
uniquely identifying abbreviation of a month\'s name (i.e., the first few
letters), and returns the corresponding number (1..12) upon a successful
match, or \"\'0\'\" otherwise (therefore, the return value can also be used as
the conditional expression in an \"if\" statement).

Note that the input string may not contain any other characters which do
not pertain to the month\'s name, especially no leading or trailing
whitespace.

Note also that matching is performed in a case-insensitive manner (this may
depend on the \"locale\" setting on your current system, though!)

With \"1\" (\"English\") as the given language, the following examples will all
return the value \"\'9\'\":

$month = Decode_Month(\"s\",1);
$month = Decode_Month(\"Sep\",1);
$month = Decode_Month(\"septemb\",1);
$month = Decode_Month(\"September\",1);

* \'if ($dow = Decode_Day_of_Week($string[,$lang]))\'

This function takes a string as its argument, which should contain the name
of a day of week in the given or currently selected language (see further
below for details about the multi-language support of this package), or any
uniquely identifying abbreviation of the name of a day of week (i.e., the
first few letters), and returns the corresponding number (1..7) upon a
successful match, or \"\'0\'\" otherwise (therefore, the return value can also
be used as the conditional expression in an \"if\" statement).

Note that the input string may not contain any other characters which do
not pertain to the name of the day of week, especially no leading or
trailing whitespace.

Note also that matching is performed in a case-insensitive manner (this may
depend on the \"locale\" setting on your current system, though!)

With \"1\" (\"English\") as the given language, the following examples will all
return the value \"\'3\'\":

$dow = Decode_Day_of_Week(\"w\",1);
$dow = Decode_Day_of_Week(\"Wed\",1);
$dow = Decode_Day_of_Week(\"wednes\",1);
$dow = Decode_Day_of_Week(\"Wednesday\",1);

* \'if ($lang = Decode_Language($string))\'

This function takes a string as its argument, which should contain the name
of one of the languages supported by this package (*IN THIS VERY LANGUAGE
ITSELF*), or any uniquely identifying abbreviation of the name of a
language (i.e., the first few letters), and returns its corresponding
internal number (1..14 in the original distribution) upon a successful
match, or \"\'0\'\" otherwise (therefore, the return value can also be used as
the conditional expression in an \"if\" statement).

Note that the input string may not contain any other characters which do
not pertain to the name of a language, especially no leading or trailing
whitespace.

Note also that matching is performed in a case-insensitive manner (this may
depend on the \"locale\" setting on your current system, though!)

The original distribution supports the following fourteen languages:

English ==> 1 (default)
Fran�ais (French) ==> 2
Deutsch (German) ==> 3
Espa�ol (Spanish) ==> 4
Portugu�s (Portuguese) ==> 5
Nederlands (Dutch) ==> 6
Italiano (Italian) ==> 7
Norsk (Norwegian) ==> 8
Svenska (Swedish) ==> 9
Dansk (Danish) ==> 10
suomi (Finnish) ==> 11
Magyar (Hungarian) ==> 12
polski (Polish) ==> 13
Romaneste (Romanian) ==> 14

See the section \"How to install additional languages\" in the file
\"INSTALL.txt\" in this distribution for how to add more languages to this
package.

In the original distribution (no other languages installed), the following
examples will all return the value \"\'3\'\":

$lang = Decode_Language(\"d\");
$lang = Decode_Language(\"de\");
$lang = Decode_Language(\"Deutsch\");

Note that you may not be able to enter the special international characters
in some of the languages\' names over the keyboard directly on some systems.

This should never be a problem, though; just enter an abbreviation of the
name of the language consisting of the first few letters up to the
character before the first special international character.

* \'if (($year,$month,$day) = Decode_Date_EU($string[,$lang]))\'

This function scans a given string and tries to parse any date which might
be embedded in it.

The function returns an empty list if it can\'t successfully extract a valid
date from its input string, or else it returns the date found.

The function accepts almost any format, as long as the date is given in the
european order (hence its name) day-month-year.

Thereby, zero or more *NON-NUMERIC* characters may *PRECEDE* the day and
*FOLLOW* the year.

Moreover, zero or more *NON-ALPHANUMERIC* characters are permitted
*BETWEEN* these three items (i.e., between day and month and between month
and year).

The month may be given either numerically (i.e., a number from \"\'1\'\" to
\"\'12\'\"), or alphanumerically, i.e., as the name of the month in the given
or currently selected language, or any uniquely identifying abbreviation
thereof.

(See further below for details about the multi-language support of this
package!)

If the year is given as one or two digits only (i.e., if the year is less
than 100), it is mapped to a \"window\" of +/- 50 years around the current
year, as described by the \"Moving_Window()\" function (see further below).

If the day, month and year are all given numerically but *WITHOUT* any
delimiting characters between them, this string of digits will be mapped to
the day, month and year as follows:

Length: Mapping:
3 dmy
4 dmyy
5 dmmyy
6 ddmmyy
7 dmmyyyy
8 ddmmyyyy

(Where \"d\" stands for \"day\", \"m\" stands for \"month\" and \"y\" stands for
\"year\".)

All other strings consisting purely of digits (without any intervening
delimiters) are rejected, i.e., not recognized.

Examples:

\"3.1.64\"
\"3 1 64\"
\"03.01.64\"
\"03/01/64\"
\"3. Jan 1964\"
\"Birthday: 3. Jan \'64 in Backnang/Germany\"
\"03-Jan-64\"
\"3.Jan1964\"
\"3Jan64\"
\"030164\"
\"3ja64\"
\"3164\"

Experiment! (See the corresponding example applications in the \"examples\"
subdirectory of this distribution in order to do so.)

* \'if (($year,$month,$day) = Decode_Date_US($string[,$lang]))\'

This function scans a given string and tries to parse any date which might
be embedded in it.

The function returns an empty list if it can\'t successfully extract a valid
date from its input string, or else it returns the date found.

The function accepts almost any format, as long as the date is given in the
U.S. american order (hence its name) month-day-year.

Thereby, zero or more *NON-ALPHANUMERIC* characters may *PRECEDE* and
*FOLLOW* the month (i.e., precede the month and separate it from the day
which follows behind).

Moreover, zero or more *NON-NUMERIC* characters are permitted *BETWEEN* the
day and the year, as well as *AFTER* the year.

The month may be given either numerically (i.e., a number from \"\'1\'\" to
\"\'12\'\"), or alphanumerically, i.e., as the name of the month in the given
or currently selected language, or any uniquely identifying abbreviation
thereof.

(See further below for details about the multi-language support of this
package!)

If the year is given as one or two digits only (i.e., if the year is less
than 100), it is mapped to a \"window\" of +/- 50 years around the current
year, as described by the \"Moving_Window()\" function (see further below).

If the month, day and year are all given numerically but *WITHOUT* any
delimiting characters between them, this string of digits will be mapped to
the month, day and year as follows:

Length: Mapping:
3 mdy
4 mdyy
5 mddyy
6 mmddyy
7 mddyyyy
8 mmddyyyy

(Where \"m\" stands for \"month\", \"d\" stands for \"day\" and \"y\" stands for
\"year\".)

All other strings consisting purely of digits (without any intervening
delimiters) are rejected, i.e., not recognized.

If only the day and the year form a contiguous string of digits, they will
be mapped as follows:

Length: Mapping:
2 dy
3 dyy
4 ddyy
5 dyyyy
6 ddyyyy

(Where \"d\" stands for \"day\" and \"y\" stands for \"year\".)

Examples:

\"1 3 64\"
\"01/03/64\"
\"Jan 3 \'64\"
\"Jan 3 1964\"
\"===> January 3rd 1964 (birthday)\"
\"Jan31964\"
\"Jan364\"
\"ja364\"
\"1364\"

Experiment! (See the corresponding example applications in the \"examples\"
subdirectory of this distribution in order to do so.)

* \'$year = Fixed_Window($yy);\'

This function applies a \"fixed window\" strategy to two-digit year numbers
in order to convert them into four-digit year numbers.

All other year numbers are passed through unchanged, except for negative
year numbers, which cause the function to return zero (\"\'0\'\") instead.

Two-digit year numbers \"\'yy\'\" below 70 are converted to \"\'20yy\'\", whereas
year numbers equal to or greater than 70 (but less than 100) are converted
to \"\'19yy\'\".

In the original distribution of this package, the base century is set to
\"1900\" and the base year to \"70\" (which is a standard on UNIX systems), but
these constants (also called the \"epoch\") can actually be chosen at will
(in the files \"DateCalc.c\" and \"DateCalc.h\") at compile time of this
module.

* \'$year = Moving_Window($yy);\'

This function applies a \"moving window\" strategy to two-digit year numbers
in order to convert them into four-digit year numbers, provided the
necessary system calls (system clock) are available. Otherwise the function
falls back to the \"fixed window\" strategy described in the function above.

All other year numbers are passed through unchanged, except for negative
year numbers, which cause the function to return zero (\"\'0\'\") instead.

Two-digit year numbers are mapped according to a \"window\" of 50 years in
both directions (past and future) around the current year.

That is, two-digit year numbers are first mapped to the same century as the
current year. If the resulting year is smaller than the current year minus
50, then one more century is added to the result. If the resulting year is
equal to or greater than the current year plus 50, then a century is
subtracted from the result.

* \'$date = Compress($year,$month,$day);\'

WARNING: This function is legacy code, its use is deprecated!

This function encodes a date in 16 bits, which is the value being returned.

The encoding scheme is as follows:

Bit number: FEDCBA9 8765 43210
Contents: yyyyyyy mmmm ddddd

(Where the \"yyyyyyy\" contain the number of the year, \"mmmm\" the number of
the month and \"ddddd\" the number of the day.)

The function returns \"\'0\'\" if the given input values do not represent a
valid date. Therefore, the return value of this function can also be used
as the conditional expression in an \"if\" statement, in order to check
whether the given input values constitute a valid date).

Through this special encoding scheme, it is possible to *COMPARE*
compressed dates for equality and order (less than/greater than) *WITHOUT*
any previous *DECODING*!

Note however that contiguous dates do *NOT* necessarily have contiguous
compressed representations!

I.e., incrementing the compressed representation of a date *MAY OR MAY NOT*
yield a valid new date!

Note also that this function can only handle dates within one century.

This century can be chosen at will (at compile time of this module) by
defining a base century and year (also called the \"epoch\"). In the original
distribution of this package, the base century is set to \"1900\" and the
base year to \"70\" (which is standard on UNIX systems).

This allows this function to handle dates from \"1970\" up to \"2069\".

If the given year is equal to, say, \"95\", this package will automatically
assume that you really meant \"1995\" instead. However, if you specify a year
number which is *SMALLER* than 70, like \"64\", for instance, this package
will assume that you really meant \"2064\".

You are not confined to two-digit (abbreviated) year numbers, though.

The function also accepts \"full-length\" year numbers, provided that they
lie in the supported range (i.e., from \"1970\" to \"2069\", in the original
configuration of this package).

Note that this function is maintained mainly for backward compatibility,
and that its use is not recommended.

* \'if (($century,$year,$month,$day) = Uncompress($date))\'

WARNING: This function is legacy code, its use is deprecated!

This function decodes dates that were encoded previously using the function
\"\'Compress()\'\".

It returns the century, year, month and day of the date encoded in
\"\'$date\'\" if \"\'$date\'\" represents a valid date, or an empty list otherwise.

The year returned in \"\'$year\'\" is actually a two-digit year number (i.e.,
the year number taken modulo 100), and only the expression \"\'$century +
$year\'\" yields the \"full-length\" year number (for example, \'1900 + 95 =
1995\').

Note that this function is maintained mainly for backward compatibility,
and that its use is not recommended.

* \'if (check_compressed($date))\'

WARNING: This function is legacy code, its use is deprecated!

This function returns \"true\" (\"\'1\'\") if the given input value constitutes a
valid compressed date, and \"false\" (\"\'0\'\") otherwise.

Note that this function is maintained mainly for backward compatibility,
and that its use is not recommended.

* \'$string = Compressed_to_Text($date[,$lang]);\'

WARNING: This function is legacy code, its use is deprecated!

This function returns a string of fixed length (always 9 characters long)
containing a textual representation of the compressed date encoded in
\"\'$date\'\".

This string has the form \"dd-Mmm-yy\", where \"dd\" is the two-digit number of
the day, \"Mmm\" are the first three letters of the name of the month in the
given or currently selected language (see further below for details about
the multi-language support of this package), and \"yy\" is the two-digit year
number (i.e., the year number taken modulo 100).

If \"\'$date\'\" does not represent a valid date, the string \"??-???-??\" is
returned instead.

Note that this function is maintained mainly for backward compatibility,
and that its use is not recommended.

* \'$string = Date_to_Text($year,$month,$day[,$lang]);\'

This function returns a string containing a textual representation of the
given date of the form \"www dd-Mmm-yyyy\", where \"www\" are the first three
letters of the name of the day of week in the given or currently selected
language, or a special abbreviation, if special abbreviations have been
defined for the given or currently selected language (see further below for
details about the multi-language support of this package), \"dd\" is the day
(one or two digits), \"Mmm\" are the first three letters of the name of the
month in the given or currently selected language, and \"yyyy\" is the number
of the year in full length.

If the given input values do not constitute a valid date, a fatal \"not a
valid date\" error occurs.

(See the section \"RECIPES\" near the end of this document for a code snippet
for how to print dates in any format you like.)

* \'$string = Date_to_Text_Long($year,$month,$day[,$lang]);\'

This function returns a string containing a textual representation of the
given date roughly of the form \"Wwwwww, dd Mmmmmm yyyy\", where \"Wwwwww\" is
the name of the day of week in the given or currently selected language
(see further below for details about the multi-language support of this
package), \"dd\" is the day (one or two digits), \"Mmmmmm\" is the name of the
month in the given or currently selected language, and \"yyyy\" is the number
of the year in full length.

The exact format of the output string depends on the given or currently
selected language. In the original distribution of this package, these
formats are defined as follows:

1 English : \"Wwwwww, Mmmmmm ddth yyyy\"
2 French : \"Wwwwww dd mmmmmm yyyy\"
3 German : \"Wwwwww, den dd. Mmmmmm yyyy\"
4 Spanish : \"Wwwwww, dd de mmmmmm de yyyy\"
5 Portuguese : \"Wwwwww, dia dd de mmmmmm de yyyy\"
6 Dutch : \"Wwwwww, dd mmmmmm yyyy\"
7 Italian : \"Wwwwww, dd Mmmmmm yyyy\"
8 Norwegian : \"wwwwww, dd. mmmmmm yyyy\"
9 Swedish : \"wwwwww, dd mmmmmm yyyy\"
10 Danish : \"wwwwww, dd. mmmmmm yyyy\"
11 Finnish : \"wwwwww, dd. mmmmmmta yyyy\"
12 Hungarian : \"dd. Mmmmmm yyyy., wwwwww\"
13 Polish : \"Wwwwww, dd Mmmmmm yyyy\"
14 Romanian : \"Wwwwww dd Mmmmmm yyyy\"

(You can change these formats in the file \"DateCalc.c\" before building this
module in order to suit your personal preferences.)

If the given input values do not constitute a valid date, a fatal \"not a
valid date\" error occurs.

In order to capitalize the day of week at the beginning of the string in
Norwegian, use \"\'ucfirst(Date_to_Text_Long($year,$month,$day,8));\'\".

(See the section \"RECIPES\" near the end of this document for an example on
how to print dates in any format you like.)

* \'$string = English_Ordinal($number);\'

This function returns a string containing the (english) abbreviation of the
ordinal number for the given (cardinal) number \"\'$number\'\".

I.e.,

0 => \'0th\' 10 => \'10th\' 20 => \'20th\'
1 => \'1st\' 11 => \'11th\' 21 => \'21st\'
2 => \'2nd\' 12 => \'12th\' 22 => \'22nd\'
3 => \'3rd\' 13 => \'13th\' 23 => \'23rd\'
4 => \'4th\' 14 => \'14th\' 24 => \'24th\'
5 => \'5th\' 15 => \'15th\' 25 => \'25th\'
6 => \'6th\' 16 => \'16th\' 26 => \'26th\'
7 => \'7th\' 17 => \'17th\' 27 => \'27th\'
8 => \'8th\' 18 => \'18th\' 28 => \'28th\'
9 => \'9th\' 19 => \'19th\' 29 => \'29th\'

etc.

* \'$string = Calendar($year,$month[,$orthodox[,$lang]]);\'

This function returns a calendar of the given month in the given year
(somewhat similar to the UNIX \"\'cal\'\" command), in the given or currently
selected language (see further below for details about the multi-language
support of this package).

Example:

print Calendar(1998,5);

This will print:

May 1998
Mon Tue Wed Thu Fri Sat Sun
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

If the optional boolean parameter \"\'$orthodox\'\" is given and true, the
calendar starts on Sunday instead of Monday.

* \'$string = Month_to_Text($month[,$lang]);\'

This function returns the name of the given month in the given or currently
selected language (see further below for details about the multi-language
support of this package).

If the given month lies outside of the valid range from \"\'1\'\" to \"\'12\'\", a
fatal \"month out of range\" error will occur.

* \'$string = Day_of_Week_to_Text($dow[,$lang]);\'

This function returns the name of the given day of week in the given or
currently selected language (see further below for details about the
multi-language support of this package).

If the given day of week lies outside of the valid range from \"\'1\'\" to
\"\'7\'\", a fatal \"day of week out of range\" error will occur.

* \'$string = Day_of_Week_Abbreviation($dow[,$lang]);\'

This function returns the special abbreviation of the name of the given day
of week, *IF* such special abbreviations have been defined for the given or
currently selected language (see further below for details about the
multi-language support of this package).

(In the original distribution of this package, this was only true for
Portuguese. Starting with version 5.1, abbreviations for Polish have also
been introduced. Starting with version 5.7, the abbreviations for
Portuguese have been disabled. So Polish is currently the only language to
define such special abbreviations.)

If not, the first three letters of the name of the day of week in the given
or currently selected language are returned instead.

If the given day of week lies outside of the valid range from \"\'1\'\" to
\"\'7\'\", a fatal \"day of week out of range\" error will occur.

Currently, this table of special abbreviations is only used by the
functions \"\'Date_to_Text()\'\" and \"\'Calendar()\'\", internally.

* \'$string = Language_to_Text($lang);\'

This function returns the name of any language supported by this package
when the internal number representing that language is given as input.

The original distribution supports the following fourteen languages:

1 ==> English (default)
2 ==> Fran�ais (French)
3 ==> Deutsch (German)
4 ==> Espa�ol (Spanish)
5 ==> Portugu�s (Portuguese)
6 ==> Nederlands (Dutch)
7 ==> Italiano (Italian)
8 ==> Norsk (Norwegian)
9 ==> Svenska (Swedish)
10 ==> Dansk (Danish)
11 ==> suomi (Finnish)
12 ==> Magyar (Hungarian)
13 ==> polski (Polish)
14 ==> Romaneste (Romanian)

See the section \"How to install additional languages\" in the file
\"INSTALL.txt\" in this distribution for how to add more languages to this
package.

See the description of the function \"\'Languages()\'\" further below to
determine how many languages are actually available in a given installation
of this package.

* \'$lang = Language();\'

* \'Language($lang); # DEPRECATED\'

* \'$oldlang = Language($newlang); # DEPRECATED\'

This function can be used to determine which language is currently
selected, and to change the selected language (this latter use is
deprecated, because this global setting may cause conflicts between threads
or modules running concurrently).

Thereby, each language has a unique internal number.

The original distribution contains the following fourteen languages:

1 ==> English (default)
2 ==> Fran�ais (French)
3 ==> Deutsch (German)
4 ==> Espa�ol (Spanish)
5 ==> Portugu�s (Portuguese)
6 ==> Nederlands (Dutch)
7 ==> Italiano (Italian)
8 ==> Norsk (Norwegian)
9 ==> Svenska (Swedish)
10 ==> Dansk (Danish)
11 ==> suomi (Finnish)
12 ==> Magyar (Hungarian)
13 ==> polski (Polish)
14 ==> Romaneste (Romanian)

See the section \"How to install additional languages\" in the file
\"INSTALL.txt\" in this distribution for how to add more languages to this
package.

See the description of the function \"\'Languages()\'\" further below to
determine how many languages are actually available in a given installation
of this package.

*BEWARE* that in order for your programs to be portable, you should *NEVER*
actually use the internal number of a language in this package
*EXPLICITLY*, because the same number could mean different languages on
different systems, depending on what languages have been added to any given
installation of this package.

Therefore, you should always use a statement such as

Language(Decode_Language(\"Name_of_Language\")); # DEPRECATED

or

DateCalc_Function(AATTparameters,Decode_Language(\"Name_of_Language\")); # RECOMMENDED

to select the desired language, and

$language = Language_to_Text(Language());

or

$old_language = Language_to_Text(Language(\"Name_of_new_Language\")); # DEPRECATED

to determine the (previously) selected language.

If the so chosen language is not available in the current installation,
this will result in an appropriate error message, instead of silently using
the wrong (a random) language (which just happens to have the same internal
number in the other installation).

*BEWARE* that when using the function \"\'Language()\'\", the selected language
is a global setting, shared by all threads or modules you might be running
concurrently, thus possibly causing conflicts between them.

In order to avoid these conflicts, you should *NEVER* use the function
\"\'Language()\'\", but should *ALWAYS* pass a language number (as returned by
the function \"\'Decode_Language()\'\") to the functions which are
language-dependent, which are:

\"Decode_Month()\", \"Decode_Day_of_Week()\", \"Compressed_to_Text()\",
\"Date_to_Text()\", \"Date_to_Text_Long()\", \"Calendar()\", \"Month_to_Text()\",
\"Day_of_Week_to_Text()\", \"Day_of_Week_Abbreviation()\", \"Decode_Date_EU()\",
\"Decode_Date_US()\", \"Decode_Date_EU2()\", \"Decode_Date_US2()\",
\"Parse_Date()\".

Note that when you pass an invalid number, such as e.g. zero, or no
language parameter at all, these functions will revert to their behaviour
in the versions of this module prior to 6.0, which means that the global
setting (as set by \"\'Language()\'\") becomes active again (only in case of an
invalid or missing language parameter!).

In the C library \"DateCalc.c\", where omitting a parameter is not an option,
passing a zero for the language is therefore the recommended way to
guarantee backward compatibility.

* \'$max_lang = Languages();\'

This function returns the (maximum) number of languages which are currently
available in your installation of this package.

(This may vary from installation to installation.)

See the section \"How to install additional languages\" in the file
\"INSTALL.txt\" in this distribution for how to add more languages to this
package.

In the original distribution of this package there are fourteen built-in
languages, therefore the value returned by this function will be \"\'14\'\" if
no other languages have been added to your particular installation.

* \'if (($year,$month,$day) = Decode_Date_EU2($string[,$lang))\'

This function is the Perl equivalent of the function \"\'Decode_Date_EU()\'\"
(implemented in C), included here merely as an example to demonstrate how
easy it is to write your own routine in Perl (using regular expressions)
adapted to your own special needs, should the necessity arise, and intended
primarily as a basis for your own development.

In one particular case this Perl version is actually slightly more
permissive than its C equivalent, as far as the class of permitted
intervening (i.e., delimiting) characters is concerned.

(Can you tell the subtle, almost insignificant difference by looking at the
code? Or by experimenting? Hint: Try the string \"a3b1c64d\" with both
functions.)

* \'if (($year,$month,$day) = Decode_Date_US2($string[,$lang))\'

This function is the Perl equivalent of the function \"\'Decode_Date_US()\'\"
(implemented in C), included here merely as an example to demonstrate how
easy it is to write your own routine in Perl (using regular expressions)
adapted to your own special needs, should the necessity arise, and intended
primarily as a basis for your own development.

In one particular case this Perl version is actually slightly more
permissive than its C equivalent.

(Hint: This is the same difference as with the \"\'Decode_Date_EU()\'\" and
\"\'Decode_Date_EU2()\'\" pair of functions.)

In a different case, the C version is a little bit more permissive than its
Perl equivalent.

(Can you tell the difference by looking at the code? Or by experimenting?
Hint: Try the string \"(1/364)\" with both functions.)

* \'if (($year,$month,$day) = Parse_Date($string[,$lang))\'

This function is useful for parsing dates as returned by the UNIX \"\'date\'\"
command or as found in the headers of e-mail (in order to determine the
date at which some e-mail has been sent or received, for instance).

Example #1:

($year,$month,$day) = Parse_Date(`/bin/date`);

Example #2:

while (< MAIL>)
{
if (/^From \\S/)
{
($year,$month,$day) = Parse_Date($_);
...
}
...
}

The function returns an empty list if it can\'t extract a valid date from
the input string.

* \'$lower = ISO_LC($string);\'

Returns a copy of the given string where all letters of the ISO-Latin-1
character set have been replaced by their lower case equivalents.

Similar to Perl\'s built-in function \"\'lc()\'\" (see perlfunc(1)/lc) but for
the whole ISO-Latin-1 character set, not just plain ASCII.

* \'$upper = ISO_UC($string);\'

Returns a copy of the given string where all letters of the ISO-Latin-1
character set have been replaced by their upper case equivalents.

Similar to Perl\'s built-in function \"\'uc()\'\" (see perlfunc(1)/uc) but for
the whole ISO-Latin-1 character set, not just plain ASCII.

* \'$string = Date::Calc::Version();\'

This function returns a string with the (numeric) version number of the C
library (\"DateCalc.c\") at the core of this package (which is also
(automatically) the version number of the \"Calc.xs\" file).

Note that under all normal circumstances, this version number should be
identical with the one found in the Perl variable \"\'$Date::Calc::VERSION\'\"
(the version number of the \"Calc.pm\" file).

Since this function is not exported, you always have to qualify it
explicitly, i.e., \"\'Date::Calc::Version()\'\".

This is to avoid possible name space conflicts with version functions from
other modules.

RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-D/15.6/noarch

Content of RPM  Provides Requires

Download
ftp.icm.edu.pl  perl-Date-Calc-6.4-lp156.1.1.noarch.rpm
     

Provides :
perl(Date::Calc)
perl(Date::Calc)
perl(Date::Calc::Object)
perl(Date::Calc::PP)
perl(Date::Calendar)
perl(Date::Calendar::Profiles)
perl(Date::Calendar::Year)
perl-Date-Calc

Requires :
perl(:MODULE_COMPAT_5.26.1)
perl(Bit::Vector) >= 7.4
perl(Carp::Clan) >= 6.04
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1


Content of RPM :
/usr/lib/perl5/vendor_perl/5.26.1/Date
/usr/lib/perl5/vendor_perl/5.26.1/Date/Calc
/usr/lib/perl5/vendor_perl/5.26.1/Date/Calc.pm
/usr/lib/perl5/vendor_perl/5.26.1/Date/Calc.pod
/usr/lib/perl5/vendor_perl/5.26.1/Date/Calc/Object.pm
/usr/lib/perl5/vendor_perl/5.26.1/Date/Calc/Object.pod
/usr/lib/perl5/vendor_perl/5.26.1/Date/Calc/PP.pm
/usr/lib/perl5/vendor_perl/5.26.1/Date/Calc/PP.pod
/usr/lib/perl5/vendor_perl/5.26.1/Date/Calendar
/usr/lib/perl5/vendor_perl/5.26.1/Date/Calendar.pm
/usr/lib/perl5/vendor_perl/5.26.1/Date/Calendar.pod
/usr/lib/perl5/vendor_perl/5.26.1/Date/Calendar/Profiles.pm
/usr/lib/perl5/vendor_perl/5.26.1/Date/Calendar/Profiles.pod
/usr/lib/perl5/vendor_perl/5.26.1/Date/Calendar/Year.pm
/usr/lib/perl5/vendor_perl/5.26.1/Date/Calendar/Year.pod
/usr/lib/perl5/vendor_perl/5.26.1/x86_64-linux-thread-multi
/usr/share/doc/packages/perl-Date-Calc
/usr/share/doc/packages/perl-Date-Calc/CHANGES.txt
/usr/share/doc/packages/perl-Date-Calc/CREDITS.txt
/usr/share/doc/packages/perl-Date-Calc/README.txt
/usr/share/licenses/perl-Date-Calc
/usr/share/licenses/perl-Date-Calc/license
/usr/share/licenses/perl-Date-Calc/license/Artistic.txt
/usr/share/licenses/perl-Date-Calc/license/GNU_GPL.txt
/usr/share/licenses/perl-Date-Calc/license/GNU_LGPL.txt
/usr/share/man/man3/Date::Calc.3pm.gz
/usr/share/man/man3/Date::Calc::Object.3pm.gz
/usr/share/man/man3/Date::Calc::PP.3pm.gz
/usr/share/man/man3/Date::Calendar.3pm.gz
/usr/share/man/man3/Date::Calendar::Profiles.3pm.gz
There is 1 files more in these RPM.

 
ICM