What is the best way people have found to convert 6 Jan 2021 21:19:42 GMT text into date and time?
Discussion posts and replies are publicly visible
Here is an alternative that uses regex if that's an option for you. The only reason I like this solution slightly better is that it can be modified to accept slightly different formats more easily. The downside is that I think regex will take slightly more time (very slightly more).
Just posting for other ideas in the future if people need them.
a!localVariables( local!userDateText: "6 Jan 2021 21:01:10 GMT", local!months: { "Jan": 1, "Feb": 2, "Mar": 3/* Continue for all months */ }, local!day: regexfirstmatch("^\d+", local!userDateText, "i"), local!month: index( local!months, regexfirstmatch("[a-zA-Z]{3}", local!userDateText), 0 ), local!year: regexfirstmatch("\d\d\d\d", local!userDateText, "i"), local!time: regexfirstmatch("\d+:\d+:\d+", local!userDateText, "i"), local!hour: split(local!time, ":")[1], local!min: split(local!time, ":")[2], local!sec: split(local!time, ":")[3], { datetime( local!year, local!month, local!day, local!hour, local!min, local!sec ) } )