Replies:

@Yuri Marx 
 

W $TR($ZDATETIME($HOROLOG,3,1)," ","T")
//adapted from (HS.FHIRServer.Utils).ConvertToUTC

#dim tSecondsPerDay = 86400

// time with offset
set tTimeWithOffset = $ZDATETIME($HOROLOG,3,5)

if (tTimeWithOffset [ "-") { set tOffsetSign = "-" }
    elseif (tTimeWithOffset [ "+") { set tOffsetSign = "+" }
    else { set tOffsetSign = "" }
    
    
if (tOffsetSign'="") {
    // compute offset in seconds
    set tOffset = $P(tTimeWithOffset,tOffsetSign,2)
    set tOffsetHrs = $P(tOffset,":")
    set tOffsetMins = $P(tOffset,":",2)
    set tOffsetInSeconds = (3600*tOffsetHrs) + (60*tOffsetMins)
    // get date/time in $H format
    set tTime = $P(tTimeWithOffset,tOffsetSign)
    set tDateTimeH = $ZDTH(tDate_"T"_tTime,3,1)
    set tDateH = $P(tDateTimeH,",")
    set tTimeH = $P(tDateTimeH,",",2)
    // UTC time = timestamp value (+/-) offset
    // might have to increment or decrement the date
    set tUTCDateH = tDateH
    if (tOffsetSign = "-") {
        set tUTCTimeH = tTimeH + tOffsetInSeconds
        if (tUTCTimeH >= tSecondsPerDay) {
            set tUTCDateH = tUTCDateH+1
            set tUTCTimeH = tUTCTimeH-tSecondsPerDay
        }
    }
    else { 
        set tUTCTimeH = tTimeH - tOffsetInSeconds
        if (tUTCTimeH < 0) {
            set tUTCDateH = tUTCDateH-1
            set tUTCTimeH = tUTCTimeH+tSecondsPerDay
        }
    }

    Set pDateTimeH = tUTCDateH_","_tUTCTimeH
    quit $TR($ZDT(pDateTimeH,3,1)," ","T")_"Z"
}
Followers:
Following:
Global Masters badges: