日期/时间转换ColdFusion [英] Date/Time Conversion ColdFusion

查看:135
本文介绍了日期/时间转换ColdFusion的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以ISO 8601格式显示日期和时间的脚本,例如: 2012-05-17T17:35:44.000Z



但是我希望在使用 #Now()#符号$ b $时以​​正常的ColdFusion时间戳格式显示b ...所以在这种格式: {ts'2012-05-17 17:35:44'}

从CF 10开始,ISO-8601直接由 parseDateTime

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

在TryCF.com上的Runnable示例


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?

解决方案

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

这篇关于日期/时间转换ColdFusion的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆