So I used TimeZoneConvert to get the time in GMT:


It outputs a date object that says Tuesday 14 March 2017 02:45:08 GMT.

But when I then try:

DayName @ TimeZoneConvert[Now, "GMT"]

I get Monday, even though the date object is a Tuesday. What's going on here?


  • $\begingroup$ Can somebody with version 10.x add the customary header for bug posts, please? $\endgroup$ Mar 31, 2017 at 5:10

1 Answer 1


Bug Confirmed by Wolfram Research

My time zone is GMT+8, which is used in this answer.

I can only explain how you get the incorrect answer.

First we need to read the definitions to trace the evaluation. The powerful tool I used is GeneralUtilities`PrintDefinitions. I will just show the main steps.

First store that converted date object in t, t = TimeZoneConvert[Now,"GMT"].

Check what's inside

DateObject[{2017, 3, 14}, 
 TimeObject[{5, 58, 23.634473}, 
  TimeZone -> "GMT"], 
 TimeZone -> "GMT"]

From the definitions of DayName,





DataPaclets`CalendarDataDump`ToInternalDate[{"Gregorian", t}, DayName]
(*{"Gregorian", 2017, 3, 13, 21, 58, 23.6345}*)

Here we noticed that this function AGAIN subtracted 8 hours from the date, which is incorrect. Its code mainly contains two parts, the first is roughly

System`DateObjectDump`$tempDate = t;
(*I added the first line to make the code works, otherwise it returns $Failed, I got the value of $tempdate from tracing*)

This returns 0, which is the time zone for this date. The return value of this function is

DateList[Join[PadRight[date, 3, 1], First @ time], TimeZone -> tz]

which is

DateList[Join[PadRight[{2017, 3, 14}, 3, 1], 
  First @TimeObject[{5, 58, 23.634473}, TimeZone -> "GMT"]], 
 TimeZone -> 0]

in our case. Unfortunately, from the docs of DateList

DateList[TimeZone->z] gives the date and time inferred for time zone z by assuming that your computer is set for the time zone specified by $TimeZone. »

It is assuming the input, {2017, 3, 14, 5, 58, 23.6345} is the local time, and converts it to TimeZone -> 0, so then another 8 hours is subtracted from it, finally we get

{2017, 3, 13, 21, 58, 23.6345}
  • 3
    $\begingroup$ @numbermaniac of course. I have filled a support form. The case number is 3859858 $\endgroup$
    – vapor
    Mar 14, 2017 at 8:15
  • $\begingroup$ Awesome, thanks! $\endgroup$ Mar 14, 2017 at 8:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.