API C_DateAndTime.GetCalendarTimeFromEpoch

From Wowpedia
Jump to: navigation, search

Returns the date of a given amount of time since the UNIX epoch, for the operating system's time zone.

date = C_DateAndTime.GetCalendarTimeFromEpoch(epoch)

Arguments

epoch 
number - time in microseconds.

Returns

date 
structure - CalendarTime
CalendarTime
Key Type Description
year number The current year (2019+)
month number The current month (1-12)
monthDay number The current day of the month (1-31)
weekday number The current day of the week (1=Sunday, 2=Monday, ..., 7=Saturday)
hour number The current time in hours (0-23)
minute number The current time in minutes (0-59)

Example

local d = C_DateAndTime.GetCalendarTimeFromEpoch(1e6 * 60 * 60 * 24)
print(format("One day since epoch is %d-%02d-%02d %02d:%02d", d.year, d.month, d.monthDay, d.hour, d.minute))
> One day since epoch is 1970-01-02 01:00

Patch changes

See also