NAME

cs::Date - convenience routines date manipulation


SYNOPSIS

        use cs::Date;
        $today = new cs::Date();


DESCRIPTION

Assorted routines for minuplating, parsing and printing date information.


GENERAL FUNCTIONS

tzoffset()

Compute the difference in seconds between localtime and UTC. Timezones ahead of UTC return a positive offset.


OBJECT ACCESS AND CREATION

new cs::Date(gmt), new cs::Date(tm,givenlocaltime)

Construct a new cs::Date object given either a time_t in GMT or a TM hash, return a cs::Date object. For the TM hash, the optional parameter givenlocaltime specifies whether the TM is in the local time zone.


OBJECT METHODS

GMTime()

Return the GMT time held by this date.

Tm(emitlocaltime)

Return a TM hash containing this date's human calendar fields. The optional parameter emitlocaltime specifies whether the TM is in the local time zone.

TMField(fieldname,emitlocaltime)

Return a particular field from this dates TM hash representation. The optional parameter emitlocaltime specifies whether the TM is in the local time zone.

Sec(emitlocaltime), Min(emitlocaltime), Hour(emitlocaltime), MDay(emitlocaltime), Mon(emitlocaltime), WDay(emitlocaltime), YDay(emitlocaltime), Year(emitlocaltime), YY(emitlocaltime)

Return this dates seconds, minutes, hours, day of month (1..31), month (1..12), day of week (Sun=0,.., Sat=6), day of year (0..365), year, short year (year-1900) from this date's TM hash, respectively.

DayCode(emitlocaltime)

Return an ISO day code of the form yyyy-mm-dd.

Hms(emitlocaltime,spacers)

Return a time code of the form hh:mm:ss. If the optional parameter spacers is supplied and false, omit the colons (`:').

a2mcode(text)

Convert the string text to a month code. Valid strings take the form YYYYMM for raw month codes, or the special words THIS, PREV and NEXT for the current month, next month and the previous month respectively. Returns undef for an invalid string.

mcodeCount(mcode,offset)

Count forwards or backwards from the supplied month code mcode as specified by offset (an integer), and return the corresponding month code.

mcode2human(mcode)

Slightly more human friendly version of a month code.