Automated updating of API pages at this location, to reflect patch changes, has ceased from 10.1.7 onwards. |
Returns the realm's current date and time.
currentCalendarTime = C_DateAndTime.GetCurrentCalendarTime()
Returns[]
- currentCalendarTime
- CalendarTime
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] |
Example[]
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
Comparison[]
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[]
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.
Patch 8.0.1 (2018-07-17): Moved to C_Calendar.GetDate()
Patch 3.0.2 (2008-10-14): Added as CalendarGetDate()