OpenBI Docs Buy

#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
ParameterTypeDescription
yearnumberThe year, 1 to 9999.
monthnumberThe month, 1 to 12.
daynumberThe day of the month.
hournumberThe hour, 0 to 23.
minutenumberThe minute, 0 to 59.
secondnumberThe second, 0 up to (not including) 60; it may have a fraction.
offsetHoursnumberThe hours of the offset from UTC: 1 for Oslo in winter, -5 for New York.
offsetMinutesnumberThe 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.

#datetime, DateTime.AddZone, DateTimeZone.SwitchZone, DateTimeZone.ToUtc.

Last updated · OpenBI Studio 0.3.79