GetGameTime

From Wowpedia
Jump to: navigation, search

Returns the realm's current time in hours and minutes.

hours, minutes = GetGameTime()

Returns

hours 
number - The current hour (0-23).
minutes 
number - The minutes passed in the current hour (0-59).

Details

  • This function can unexpectedly return results inconsistent with actual realm server time. The value returned is from the physical instance server you are actually playing on, and not that of the world instance server (realm server) you log into. Servers for instances such as for raids and PvP are often shared between login world servers, and instance servers are not always running using the same timezone as the login realm server. This is particularly noticeable for Oceanic and other low population world servers.

Example

/dump GetGameTime()
> 18, 41

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.

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

See also

External links