Question Eric Tulowetzke · May 23

Best Practice for handling timezone offsets in DTL

Hi all,

My team is exploring options for handling timezone offsets in DTL and we’re wondering if there are any built-in methods available — ideally low-code or no-code solutions. Specifically, we're looking for a way to adjust timestamps based on the date and whether Daylight Saving Time (DST) is in effect.

For example, if an HL7 message has an MSH-7 value of 20250518144529, it should be converted to 20250518144529-0500 (Central Daylight Time), but if the timestamp were 20250218144529, it should be 20250218144529-0600 (Central Standard Time).

We’re fairly new to InterSystems and want to make sure we’re not reinventing the wheel if there’s already a best practice or supported feature for this.

Thanks in advance for any guidance!

Product version: HealthShare 2024.1
$ZV: HealthConnect:7.2.0-2.m1

Comments

Michael Davidovich · May 23

I tend to use $SYSTEM.SQL.Functions.DATEADD()

You can use this to add seconds, minutes, hours, days, etc. to  date.  The date/time should be ODBC e.g "2025-05-21T14:52:47.986"

There may be other ways, but this is how I do it to deal with UTC offsets.  

0
Michael Davidovich  May 23 to Michael Davidovich

USER>s time=$tr("abcd-ef-gh ij:kl:00","abcdefghijkl",20250518144529)

USER>w time
2025-05-18 14:45:00
USER>s time=$SYSTEM.SQL.Functions.DATEADD("hh",-6,time)

USER>w time
2025-05-18 08:45:00

0
Eric Tulowetzke  May 23 to Michael Davidovich

Ya we know there is a lot of edge cases. We tried to handle them in our old system Cloverleaf with Tcl/Tk code, and before moving to InterSystems using Objectscript we wanted to do research on what way was best. Thank you for feedback.

0