Time zones

20 views
Skip to first unread message

jfh

unread,
Jun 16, 2022, 9:17:51 PM6/16/22
to
Wishing to use Date in my own time zone I tried

> now:=Date(timezone="NZST");
Error, (in Date:-ModuleCopy) unrecognised timezone: NZST

Maple must have a list of acceptable time zone names. How does one find it?
Experimentation eventually found that at present the following works, though of course it will need changing in September when we start daylight saving., and back again in April 2023.

> now:=Date(timezone="GMT+12:00");
now := <Date: 2022-06-17T13:07:28 GMT+12:00>

acer

unread,
Jun 21, 2022, 12:13:45 PM6/21/22
to
Using the 2nd column here, ie. "TZ database name",
https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List

restart;
with(Calendar):
d1:=Date(timezone="Pacific/Auckland");
d1 := <Date: 2022-06-22T04:09:07 New Zealand Time>

d2:=Date(timezone="GMT+12:00")
d2 := <Date: 2022-06-22T04:09:07 GMT+12:00>

DateDifference(Date(timezone="Pacific/Auckland"),
Date(timezone="GMT+12:00"));
0

Format(d1);
"2022-06-21T12:09:07 EDT"

Format(d2);
"2022-06-21T12:09:07 EDT"

jfh

unread,
Jun 21, 2022, 5:37:33 PM6/21/22
to
Thank you. I live in Wellington, which is NZ's capital city, so I had not thought of trying Pacific/Auckland. Let's hope that Maple does better than a famous US newspaper when we or US move in or out of daylight saving. (They had been given a time-embargoed copy of NZ's latest budget and released it 1 hour too soon. Our government were not happy.)

acer

unread,
Jun 21, 2022, 6:01:30 PM6/21/22
to
I'll reiterate that that timezome name -- Pacific/Aukland -- is not something Maple developers cooked up. It's part of a reasonably standard set of names, managed by international committee. It took me less than a few minutes to find it via google.

You appear to have got stuck on trying to work with just some abbreviations.

Note that your attempt to utilize NZST may not have fared better (even if recognized), as far as switching to Daylight Saving goes. NZDT is not the very same thing.

acer

unread,
Jun 21, 2022, 6:06:01 PM6/21/22
to
...and, naturally, I misspell Auckland in a bad moment. Apologies.
Reply all
Reply to author
Forward
0 new messages