From Warcraft Wiki
Jump to navigation Jump to search
GitHub Octocat.png  Townlong-Yak BAD.png  ProfIcons engineering.png  BTNTemp.png C_DateAndTime.GetCurrentCalendarTime TheWarWithin-Icon-Inline.pngDragonflight-Icon-Inline.pngCata-Logo-Small.pngWrath-Logo-Small.pngWoW Icon update.png + 8.1.0 / 1.15.0
BTNTemp.png C_Calendar.GetDate + 8.0.1
Wowprogramming.png  BTNTemp.png CalendarGetDate + 3.0.2

Returns the realm's current date and time.

currentCalendarTime = C_DateAndTime.GetCurrentCalendarTime()


Field Type Description
year number The current year (e.g. 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. Note that time() and date() are tied to your system's clock which can be manually changed.

-- unix time
time()                             -- 1596157547
GetServerTime())                   -- 1596157549

-- local time, same as `date(nil, time())`
date()                             -- "Fri Jul 31 03:05:47 2020"

-- realm time
GetGameTime()                          -- 20, 4
C_DateAndTime.GetCurrentCalendarTime() -- hour:20, minute:4
C_DateAndTime.GetServerTimeLocal()     -- 1596139440 unix time offset by the server's time zone (e.g. UTC minus 5 hours)

Patch changes

Battle for Azeroth Patch 8.1.0 (2018-12-11): Moved to C_DateAndTime.GetCurrentCalendarTime(). The previous alias is deprecated [1]. See ConvertToOldStyleDate() for changes with the old format.
Battle for Azeroth Patch 8.0.1 (2018-07-17): Moved to C_Calendar.GetDate()
Wrath-Logo-Small.png Patch 3.0.2 (2008-10-14): Added as CalendarGetDate()