Codeunit "Time Zone"
Codeunit that provides data on offsets and daylight saving time for a time zone.
Properties
| Name | Value |
|---|---|
| InherentEntitlements | X |
| InherentPermissions | X |
Methods
GetTimezoneOffset
Retrieves the offset from the requested time zone at the time of the requested datetime. This takes into account any daylight saving time conditions that may apply.
procedure GetTimezoneOffset(SourceDateTime: DateTime, TimeZoneId: Text): Duration
Parameters
| Name | Type | Description |
|---|---|---|
| SourceDateTime | DateTime |
The datetime that will be used as the basis for the difference calculation. |
| TimeZoneId | Text |
The ID of the time zone that you want to calculate the offset for. |
Returns
| Type | Description |
|---|---|
| Duration |
A duration that indicates the offset between UTC and the requested time zone for the provided datetime. |
GetTimezoneOffset
Retrieves the offset from the user time zone at the time of the requested datetime. This takes into account any daylight saving time conditions that may apply.
procedure GetTimezoneOffset(SourceDateTime: DateTime): Duration
Parameters
| Name | Type | Description |
|---|---|---|
| SourceDateTime | DateTime |
The datetime that will be used as the basis for the difference calculation. |
Returns
| Type | Description |
|---|---|
| Duration |
A duration that indicates the offset between UTC and the user time zone for the provided datetime. |
GetTimezoneOffset
Retrieves the offset of the destination time zone from the source time zone for the indicated datetime. This takes into account any daylight saving time conditions that may apply.
procedure GetTimezoneOffset(SourceDateTime: DateTime, SourceTimeZoneId: Text, DestinationTimeZoneId: Text): Duration
Parameters
| Name | Type | Description |
|---|---|---|
| SourceDateTime | DateTime |
The datetime that will be used as the basis for the difference calculation. |
| SourceTimeZoneId | Text |
The time zone from which you want to calculate the difference. |
| DestinationTimeZoneId | Text |
The time zone against which you want to calculate the difference. |
Returns
| Type | Description |
|---|---|
| Duration |
A duration that indicates the offset between the two time zones at the indicated datetime. |
TimeZoneSupportsDaylightSavingTime
Checks whether the indicated time zone supports daylight saving time.
procedure TimeZoneSupportsDaylightSavingTime(TimeZoneId: Text): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| TimeZoneId | Text |
The ID of the time zone that you want to check the daylight saving time settings for. |
Returns
| Type | Description |
|---|---|
| Boolean |
A boolean indicating whether the requested time zone observes daylight saving time. |
IsDaylightSavingTime
Checks whether the requested datetime falls within the indicated time zone's daylight saving time period.
procedure IsDaylightSavingTime(DateTimeToCheck: DateTime, TimeZoneId: Text): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| DateTimeToCheck | DateTime |
The datetime for which you want to check whether it falls within the time zone's daylight saving time period. |
| TimeZoneId | Text |
The ID of the time zone against which you want to check the datetime. |
Returns
| Type | Description |
|---|---|
| Boolean |
A boolean indicating whether the requested datetime falls within the daylight saving time period for the indicated time zone. If the time zone does not observe daylight saving time, this will always return false. |