Does Outsystems support ISO-8601 date formats?

I'm getting information from an external database which stores date-times in ISO-8601: 

"2019-01-20T01:22:33.123Z"

Is there a nice way to use this in outsystems? Is there a built-in way to convert this to an OS date-time or do I need to use ugly string manipulations? Likewise to turn an OS datetime into a string of the right format to send a date to the API

Solution

Hi MichaelR,

For converting outsystems date to iso-8601 string you can use forge component: https://www.outsystems.com/forge/Overview.aspx?ProjectId=90&ProjectName=extended-datetime

For converting the string to a date you could try to use the JSON Serialize/Deserialize to convert the iso8601 to date. On these function you can set the date format.

Regards,

Daniel

Solution

Daniël Kuhlmann wrote:

Hi MichaelR,

For converting outsystems date to iso-8601 string you can use forge component: https://www.outsystems.com/forge/Overview.aspx?ProjectId=90&ProjectName=extended-datetime

For converting the string to a date you could try to use the JSON Serialize/Deserialize to convert the iso8601 to date. On these function you can set the date format.

Regards,

Daniel

Ah thanks, I'd missed the JSON deserialiser's ability to convert.


To go from DateTime to a string, I found the Text API's Format_DateTime method. I can feed in an OS DateTime and the string "yyyy-MM-ddTHH:mm:ss.000Z", which gets me back to where I started - although I lose the decimals on the seconds since OS DateTime doesn't  seem to support them