time/Time

module methods:

value methods:

==

(Time == any) -> bool

formats

keyvalue
ANSICMon Jan _2 15:04:05 2006
UnixDateMon Jan _2 15:04:05 MST 2006
RubyDateMon Jan 02 15:04:05 -0700 2006
RFC82202 Jan 06 15:04 MST
RFC822Z02 Jan 06 15:04 -0700
RFC850Monday, 02-Jan-06 15:04:05 MST
RFC1123Mon, 02 Jan 2006 15:04:05 MST
RFC1123ZMon, 02 Jan 2006 15:04:05 -0700
RFC33392006-01-02T15:04:05Z07:00
RFC3339Nano2006-01-02T15:04:05.999999999Z07:00
Kitchen3:04PM
StampJan _2 15:04:05
StampMilliJan _2 15:04:05.000
StampMicroJan _2 15:04:05.000000
StampNanoJan _2 15:04:05.000000000

format

Returns a textual representation of the time value formatted according to layout.

(Time format layout(string)) -> string

clock

Returns the hour, minute, and second within the day specified by Time.

(Time clock) -> [hour(int),min(int),sec(int)]

year

Returns the year in which Time occurs.

(Time year) -> int

month

Returns the month of the year specified by Time.

(Time month) -> [int, string]

day

Returns the day of the month specified by Time.

(Time day) -> int

hour

Returns the hour within the day specified by Time, in the range [0, 23].

(Time hour) -> int

minute

Returns the minute offset within the hour specified by Time, in the range [0, 59].

(Time minute) -> int

second

Returns the second offset within the minute specified by Time, in the range [0, 59].

(Time second) -> int

nanosecond

Returns the nanosecond offset within the second specified by Time, in the range [0, 999999999].

(Time nanosecond) -> int

weekday

Returns the day of the week specified by Time.

(Time weekday) -> [int, string]

date

Returns the year, month, and day in which Time occurs.

(Time date) -> [int, [int, string], int]

iso_week

Returns the ISO 8601 year and week number in which Time occurs. Week ranges from 1 to 53. Jan 01 to Jan 03 of year n might belong to week 52 or 53 of year n-1, and Dec 29 to Dec 31 might belong to week 1 of year n+1.

(Time iso_week) -> [int, int]

zero?

Reports whether Time represents the zero time instant, January 1, year 1, 00:00:00 UTC.

(Time zero?) -> bool

local

Returns Time with the location set to local time.

(Time local) -> time

location

Returns the time zone information associated with Time.

(Time location) -> time

zone

Computes the time zone in effect at time Time, returning the abbreviated name of the zone (such as "CET") and its offset in seconds east of UTC.

(Time zone) -> [string, int]

unix

Returns t as a Unix time, the number of seconds elapsed since January 1, 1970 UTC. The result does not depend on the location associated with Time.

(Time unix) -> int

unix_nano

Returns Time as a Unix time, the number of nanoseconds elapsed since January 1, 1970 UTC.

(Time unix_nano) -> int

year_day

Returns the day of the year specified by Time, in the range [1,365] for non-leap years, and [1,366] in leap years.

(Time year_day) -> int

UTC

Returns Time with the location set to UTC.

(Time UTC) -> time

add_date

Returns Time with the location set to UTC.

(Time add_date year(int) month(int) day(int)) -> time

add

Returns the time Time+dur.

(Time add dur(duration)) -> time

sub

returns the duration Time-time.

(Time sub time(time)) -> duration

round

Returns the result of rounding Time to the nearest multiple of dur (since the zero time).

(Time round dur(duration)) -> time

truncate

Returns the result of rounding Time down to a multiple of dur (since the zero time).

(Time truncate dur(duration)) -> time

in

Returns a copy of t representing the same time instant, but with the copy's location information set to loc for display purposes.

(Time in loc(string)) -> time

after?

reports whether the time instant Time is after t.

(Time after? t(time)) -> bool

before?

reports whether the time instant Time is before t.

(Time before? t(time)) -> bool

equal?

reports whether Time and t represent the same time instant.

(Time equal? t(time)) -> bool