To contents Next section

14.16.1 Calendar.time_unit

CLASS
Calendar.time_unit

DESCRIPTION

METHOD
Calendar.time_unit.greater

SYNTAX
array(string) greater()

DESCRIPTION
Gives a list of methods to get greater (longer) time units from this object. For a month, this gives back ({"year"}), thus the method month->year() gives the year object.

METHOD
Calendar.time_unit.lesser

SYNTAX
array(string) lesser()

DESCRIPTION
Gives a list of methods to get lesser (shorter) time units. ie, for a month, this gives back ({"day"}) and the method day(mixed n) gives back that day object. The method days() gives back a list of possible argument values to the method day. Concurrently, Array.map(o->days(),o->day) gives a list of day objects in the object o.

Ie:

array(string) lesser()    - gives back a list of possible xxx's.
object xxxs()             - gives back a list of possible n's.
object xxx(mixed n)       - gives back xxx n
object xxx(object(Xxx) o) - gives back the corresponing xxx

The list of n's (as returned from xxxs) are always in order.

There are two n's with special meaning, 0 and -1. 0 always gives the first xxx, equal to my_obj->xxx(my_obj->xxxs()[0]), and -1 gives the last, equal to my_obj->xxx(my_obj->xxxs()[-1]).

To get all xxxs in the object, do something like Array.map(my_obj->xxxs(),my_obj->xxx).

xxx(object) may return zero, if there was no correspondning xxx.

METHOD
Calendar.time_unit.`+,
Calendar.time_unit.`-,
Calendar.time_unit.next,
Calendar.time_unit.prev

SYNTAX
object next()
object prev()
object `+(int n)
object `-(int n)
object `-(object x)

DESCRIPTION
next and prev gives the logical next and previous object. The + operator gives that logical relative object, ie my_day+14 gives 14 days ahead. - works the same way, but can also take an object of the same type and give the difference as an integer.

To contents Next section