#datetimezone
Makes a datetimezone: a date and time together with its offset from UTC.
Group: Dates and times. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
#datetimezone(year as number, month as number, day as number, hour as number, minute as number, second as number, offsetHours as number, offsetMinutes as number) as datetimezone
| Parameter | Type | Description |
|---|---|---|
year | number | The year, 1 to 9999. |
month | number | The month, 1 to 12. |
day | number | The day of the month. |
hour | number | The hour, 0 to 23. |
minute | number | The minute, 0 to 59. |
second | number | The second, 0 up to (not including) 60; it may have a fraction. |
offsetHours | number | The hours of the offset from UTC: 1 for Oslo in winter, -5 for New York. |
offsetMinutes | number | The minutes of the offset, for zones such as India's +05:30. |
Returns
datetimezone. The moment with its offset.
Remarks
- The clock time and the offset are kept as given: the value is not turned into UTC.
- Two datetimezones are equal when they are the same instant, whatever their offsets.
Examples
An order placed in Oslo in winter
#datetimezone(2024, 3, 15, 14, 30, 0, 1, 0)
#datetimezone(2024, 3, 15, 14, 30, 0, 1, 0)
An offset with minutes
#datetimezone(2024, 3, 15, 19, 0, 0, 5, 30)
#datetimezone(2024, 3, 15, 19, 0, 0, 5, 30)
The same instant in two zones
#datetimezone(2024, 3, 15, 14, 30, 0, 1, 0) = #datetimezone(2024, 3, 15, 13, 30, 0, 0, 0)
true
14:30 at +01:00 and 13:30 at UTC are one and the same instant.
Related functions
#datetime, DateTime.AddZone, DateTimeZone.SwitchZone, DateTimeZone.ToUtc.