Time

Time represents a ingame time of day.

Constructors

Time ( integer hours, integer minutes )

Creates a Time object with given hours and minutes.

Time ( integer hours )

Creates a Time object with given hours.

Time ( integer hours, integer minutes, integer seconds )

Creates a Time object with given hours, minutes and seconds.

local myTime = Time(12, 30)

Built-in instances

Current ingame day time.
Shortcut to TimeCycle.CurrentTime.

-- sets time to noon for everyone
Time.Current = Time.Noon
-- same as:
CurrentTime.CurrentTime = Time.Noon

Dawn time.

Dusk time.

Midnight time.

Noon time.

Functions

Returns elapsed seconds since January 1, 1970 UTC.

Client.Action2 = function()
  print("time:", Time.Unix(), "s")
end

Returns elapsed milliseconds since January 1, 1970 UTC.

Client.Action2 = function()
  print("time:", Time.UnixMilli(), "ms")
end

Properties

H is a shortcut to Hour.

local t = Time.Noon
print(t.H) -- prints "12"

Hour represents the hour within Time, in the range [0,23].

local t = Time.Noon
print(t.Hours) -- prints "12"

M is a shortcut to Minute.

local t = Time(12, 30, 45)
print(t.M) -- prints "30"

Minute represents the minute offset within the hour of Time, in the range [0,59].

local t = Time(12, 30, 45)
print(t.Minute) -- prints "30"

S is a shortcut to Second.

local t = Time(12, 30, 45)
print(t.S) -- prints "45"

Second represents the second within the minute of Time, in the range [0,59].

local t = Time(12, 30, 45)
print(t.Second) -- prints "45"