Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Date/Time Conversion ColdFusion

I'm working with a script that displays the date and time in ISO 8601 format like so: 2012-05-17T17:35:44.000Z.

but I would like it to display in the normal ColdFusion timestamp format when using the #Now()# notation ... so in this format: {ts '2012-05-17 17:35:44'}

How can I do this?

like image 630
Mike Avatar asked Feb 20 '23 11:02

Mike


1 Answers

As of CF 10, ISO-8601 is supported directly by parseDateTime.

<cfset string = "1997-07-16T19:20:30+01:00">
<cfset date = parseDateTime(string, "yyyy-MM-dd'T'HH:mm:ssX")>

Runnable Example on TryCF.com

like image 190
Tim Sylvester Avatar answered Feb 26 '23 21:02

Tim Sylvester