Question
· Dec 24, 2025

I want to change the date in an HL7 Data Transformation

Here is what is currently used.

..CurrentDateTime("%Y%m%d%H%M%S")

The format is not the issue.

I need to make it our current time as it is five hours ahead.

How can I access the header property of either of these.

Or, if I can't do that, subtract five hours or the equivalent time in seconds.

example, if I receive 20201224161922, how can I make it 20201224111922?

Thanks,

Jonathan

Product version: IRIS 2025.1
Discussion (3)2
Log in or sign up to continue

To adjust a datetime by subtracting five hours or 18,000 seconds (5 hours * 60 minutes * 60 seconds) in an HL7 Data Transformation, you can use ObjectScript utilities designed for time manipulation.

  1. Using ConvertDateTime function: InterSystems provides the ConvertDateTime() utility in Ens.Util.Time. Example:

    Set NewDate = ##class(Ens.Util.Time).ConvertDateTime("20201224161922", "%Y%m%d%H%M%S", "YYYYMMDDHHMISS")
    

    This function allows you to manipulate date formats and apply operations on datetime values [1].

  2. Time zone library: There's also a specialized library for converting and handling time zones with both HL7 formatted times and adjustments. An example of subtracting a specific duration (5 hours in your case):

    Set datetime = "20201224161922"
    Set newDatetime = ##class(Ens.Util.Time).SubtractSeconds(datetime, 18000) ; Subtracting 18,000 seconds (5 hours)
    

    This will yield 20201224111922 [2].

These approaches can be used directly in your transformation logic for accurate date-time operations. If using time zones or further functionalities, refer to the utilities within InterSystems' interoperability tools or libraries [1][2].

Sources:

Hey Jonathan.

The utility function ..CurrentDateTime() should be returning a value that is based on the servers local timezone. As you're in EST, I'm guessing you're getting UTC/GMT. You might want to look at addressing this early and not code around it just yet as this could then be corrected at an OS level and you're suddenly subtracting 50000 from the correct result.