Class Val.Timestamp

Inheritance graph
Val.Timebase Val.Timestamp

Lightweight time and date type. The values point at absolute points in time. The values are stored internally with nanosecond resolution since epoch (1970/01/01 00:00:00 UTC). Supports arithmetic with Interval objects. Cast it to int or float to obtain unix_time.

See also

Interval, Date, Range, localtime(), mktime()

Inherit Timebase

inherit Timebase : Timebase

Method create

Val.Timestamp Val.Timestamp(int year, int month, int day, void|int hour, void|int min, void|int sec, void|int nsec)
Val.Timestamp Val.Timestamp(int unix_time, void|int nsec)

Parameter year

Absolute year (e.g. 1900 == 1900, 2000 = 2000, 2017 == 2017).

Parameter month

Month of the year (January == 1 ... December == 12).

Parameter day

Day of the month (typically between 1 and 31).

Parameter hour

Hour of the day (typically between 0 and 23).

Parameter min

Minutes (typically between 0 and 59).

Parameter sec

Seconds (typically between 0 and 59).

Parameter nsec

Nanoseconds (typically between 0 and 999999999).


Specified values are expected in the localised time (i.e. relative to the current timezone locale, including daylight-saving correction).


If any of these values are offered in a denormalised range, they will be normalised relative to the startdate offered. I.e. it allows primitive year/month/day/hour/minute/second/nanosecond arithmetic. For more advanced arithmetic you must use Interval objects.

See also

localtime(), mktime()