To be clear: You get dates as strings, and you want to convert them to actual datetime objects, right ?
Then you'll need to parse them with system.date.parse. formatDates is there to take a datetime object as input, and output a string representing that datetime in a specific format.
Datetimes objects do not have formats. Only their string representations do.
But since, in order to see them, they have to be represented... they're represented with some format, that actually has nothing to do with the date itself.
Also be aware that 'Z' indicates that the time is UTC or "Zero time zone". You may need to take this into account in your application and handle both time zone and daylight savings - if applicable.
Agreed Transistor. Absolutely. We use DST, so gives that extra bit of work.
Are there any library/function that can handle this automatically? For example, takes the UTC time and desired time zone and return the converted time?
Ignition does it automatically of you let your database base save in UTC. In Perspective Designer you can specify whether the project should convert to gateway timezone or client timezone. I don't know how Vision handles it.
I have been able convert the date/time string into date/time type.
I took Jordan's solution and played around with it till I got what I wanted. Basically declared a new dataset and wrote on it row by row. Everything's sweet.
Now. let's move on to another hurdle.
Thank you everyone. Hope you all have a lovely break!