ColdFusion - Date and Time formatting is rounding up 5 minutes

心已入冬 提交于 2019-12-24 08:47:00

问题


I have the following date string:

2017-05-02 08:00:00.0 

When I apply datetimeformat() like:

 #datetimeformat(item.getValue('releasedate'), 'h:mm a')#

It is rounding up by 5 minutes and outputting: 8:05 AM. In the code above, 'releasedate' is the string that is being passed in.

How do I fix this?


回答1:


Nobody is rounding anything. You are outputting the month here instead of the minutes, and the month happens to be May, so that is 05 with leading zero.

https://cfdocs.org/datetimeformat:

mm: Month as digits; leading zero for single-digit months.

Minutes are not mm here, but

nn: minutes; a leading zero for single-digit minutes



来源:https://stackoverflow.com/questions/43737301/coldfusion-date-and-time-formatting-is-rounding-up-5-minutes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!