From Wowpedia
Jump to: navigation, search

Returns the realm's current date and time.

currentCalendarTime = C_DateAndTime.GetCurrentCalendarTime()


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)


local d = C_DateAndTime.GetCurrentCalendarTime()
local weekDay = CALENDAR_WEEKDAY_NAMES[d.weekday]
local month = CALENDAR_FULLDATE_MONTH_NAMES[d.month]
print(format("The time is %02d:%02d, %s, %d %s %d", d.hour, d.minute, weekDay, d.monthDay, month, d.year))
-- The time is 07:55, Friday, 15 March 2019


When in a EU time zone CEST (UTC+2) and playing on Moon Guard US, CDT (UTC-5). The examples were taken at the same time.

-- unix time
time()                             -- 1596157547
GetServerTime())                   -- 1596157549
C_DateAndTime.GetServerTimeLocal() -- 1596139440 unix time offset by UTC (e.g. minus 5 hours)

-- local time
date()                             -- "Fri Jul 31 03:05:47 2020"

-- realm time
GetGameTime()                          -- 20, 4
C_DateAndTime.GetCurrentCalendarTime() -- hour:20, minute:4

Patch changes

External links