Lewis Houlden · Mar 22, 2022

Time handling and Json

I am having trouble formatting %Time to a JSON format. I have tried configuring the parameter "FORMAT" of my property but that didn't work. For some reason, it keeps putting a Z and the end of the time. 


Property TimeCollected As %Time(FORMAT = "2");

Setting the Property through a custom function which is used in the DTL:

set convertedDateTime= ##class(Ens.Util.Time).ConvertDateTime("202203220800","%q(1)","%q(3)") //Setting to HoroLog format
set pOutput = $PIECE(convertedDateTime,",",*) //splitting to obtain seconds past midnight 

Testing the DTL, and also converting to JSON has the same result, shows:

I can't explain why it's adding the Z at the end. Am I missing something obvious?

Any help would be greatly appreciated.

Product version: IRIS 2021.1
0 111
Discussion (2)1
Log in or sign up to continue

hi Lewis, Search for 'Handling the UTC Time Zone Indicator'' in the documentation. This may help you. Property TimeCollected As %Time(XMLTIMEZONE = "IGNORE");

Thank you so much for this! Worked a treat.