Date class

Class date is designed for working with dates. Possible variants of using it include: calendars, various checks based on dates, etc.

Values may range from 01/01/1970 to 01/01/2038.

Do not forget that we have different gaps and overlaps: many countries have so-called Daylight Saving Time, when clock is set ahead (in spring) or back (in autumn) one hour.
For example, in Moscow, there cannot be "02:00, 31 March 2002," while "02:00, 27 October 2002" can be twice.

Numeric value of object of class
date equals to the number of days from EPOCH (00:00:00, 1 January 1970, UTC) to the date specified in the object. This feature is useful when you want to get a relative date, e.g.:

# checking if the file was updated more than a week ago
^if($last_update > $now-7){
   new
}{
   old
}

The number of days can be fractional, e.g. a day and half is equal to
1.5.

The class usually operates local date and time. Still, you can get date and time in arbitrary time zone (see
^date.roll[TZ;…].

To communicate between computers that are in different time zones it is convinient to exchange values of date/time which do not depend on timezone-UNIX format, which is number of seconds passed since EPOCH, is very convinient here.

Unix format can be used in JavaScript and several other scripting languages that work in browser.

Parser fully supports work with UNIX date format.



Copyright © 1997–2010 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 24.12.2004