Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:GetTimeStamp

From RoR Wiki

UI Lua API · Time functions
Version: WAR 1.4.8

Converts a local date and time to a Unix timestamp.

timestamp = GetTimeStamp(month, day, year, hour, minute)

Arguments

month
number – Month, 1–12.
day
number – Day of the month.
year
number – Year, for example 2008.
hour
number – Hour, 0–23.
minute
number – Minute, 0–59.

Returns

timestamp
number – Seconds since 1 January 1970 (UTC) for that local date and time.

Details

  • The date and time are taken as the computer's local time. Seconds are always 0. The daylight-saving flag of the current local time is used for the conversion.
  • All arguments are cut to whole numbers. month, day, hour and minute keep only their lowest 8 bits (0–255) and year its lowest 16 bits (0–65535).
  • The values are not range-checked before the conversion.
  • The result is returned as an unsigned 32-bit value.
  • The function needs at least five arguments and only reads the last five.

Errors

None besides the generic Invalid Parameters message when an argument is not a number.

Example

From ea_guildwindow/source/guildwindowtabcalendar.lua:

local paramTimeStamp = GetTimeStamp(month, day, year, 12, 0)
...
startTimeStamp = GetTimeStamp(data.startMonth, data.startDay, data.startYear, 0, 0)
endTimeStamp = GetTimeStamp(data.endMonth, data.endDay, data.endYear, 23, 59)

See also