Problem with READ-XML Method for DATETIME-TZ data

Zeter.2020

New Member
Platform: Win10Pro, OE12.2, startup param -d dmy

I have XML file (produced by third party) that contains datatime-tz field with value "2022-06-30T22:00:00Z".
I use "READ-XML" method to read data to dataset, where I declared field "datatime-tz".
The result in temp-table field is "2022-06-30 22:00:00.000+00:00"
while I expected result "2022-06-30 22:00:00.000+02:00" indicating 2022-07-01 00:00:00

XML File (cFileName):
....
<OrderData OrderDate="2022-04-30T22:00:00Z" OrderValue="2563.1" status="1"/>
...

DEFINE TEMP-TABLE SourceTable NO-UNDO
FIELD OrderDate AS DATETIME-TZ
FIELD OrderValue AS DECIMAL
...

DEFINE DATASET ReqOrder NAMESPACE-URI ""
XML-NODE-TYPE "HIDDEN"
FOR SourceTable.

lOK = DATASET ReqOrder:READ-XML
('file' /* Source Type */
,cFileName /* XML File Name */
,'empty' /* clear temp-table */
,? /* cXSDSchFile */
,? /* no */
).

What have I to do to obtain proper value ?

An interesting fact is that if I change the date in the XML file from "2022-06-30T22:00:00Z" to "2022-06-30T22:00:00" (remove "Z"), I get the correct result, which is "2022-06-30T22: 00:00.000+02:00"
 
Z = UTC Time Zone (+00:00)
"2022-06-30 22:00:00.000Z" is equal to "2022-06-30 22:00:00.000+00:00", this is correct ✔

If you need to represent the timestamp into local time zone (+02:00) you need to add-on the local timezone offset.
 
Possibly needed to include a client start-up parameter -useSessionTZ 1
 
Back
Top