Time zones
While eminently practical and relatively easy to understand, time zones have caused issues with software systems and programming from the very dawn of computing. Fortunately, the M language includes the datetimezone data type, with an array of supporting functions that ease the burden of dealing with dates and times that include time zones.
Unlike date, time, and datetime data types, datetimezone data types cannot be represented solely as decimal numbers. In fact, creating a datetimezone value using DateTimeZone.From(45336.5)
adds the additional time zone information of the local system, returning 2/14/2024 12:00:00 PM -05:00
, for example, for a system running in the United States EST time zone.
There are actually two additional elements for a datetimezone data type: ZoneHours
and ZoneMinutes
. These additional elements can be retrieved using the DateTimeZone.ZoneHours
and DateTimeZone.ZoneMinutes
functions, respectively. Additionally, the DateTimeZone.ToRecord
function...