API C_DateAndTime.GetCurrentCalendarTime

From Wowpedia
Jump to: navigation, search

Returns the realm's current date and time.

date = C_DateAndTime.GetCurrentCalendarTime()

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.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

Patch changes

See also