Question:
What's an arithmetic expression that can be used in a workflow to ensure the correct date time is returned when daylight savings time needs to be considered?
Solution:
Commencing in DocuWare 7.8, the custom function ToOrgDateTime(DWTimeZoneInfo.ORG) was introduced to shift the provided DateTime to your organization's time zone.
This function also supports daylight-saving time and would be the recommended way for such conversions;
<MyDateTime>.ToOrgDateTime(DWTimeZoneInfo.ORG)
Example:
You want to return a string of the current date and time in the organization's time zone.
The time zone specified in the organization settings is UTC+1, but it is June 1st (daylight saving period), which means the desired time zone is UTC+2.
Current time: 01 June 2023 08:41:06 (UTC)
Desired output: 01 June 2023 10:41:06 (UTC+2)
In this example, to retrieve the current date and time, we use the property Now:
Now.ToOrgDateTime(DWTimeZoneInfo.ORG).ToString
Returns: 6/01/2023 10:41:06 AM
You can change the format by specifying a custom format:
Now.ToOrgDateTime(DWTimeZoneInfo.ORG).ToString("MMMM-dd-yyyy h:mm tt")
Returns: June-01-2023 10:41 AM
For additional information on this and more arithmetic expressions, please refer to the DocuWare Knowledge Center.
KBA is applicable for both Cloud and On-premise Organizations