Appian Community and Appian Academy are being upgraded. From July 24–August 3, the Appian Community will be in read-only mode. During this time, the site will be read-only and user registration will be disabled. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!
The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.
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 ) } )