Question
· 20 hr ago

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 (1)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: