ColdFusion-日期和时间格式四舍五入 [英] ColdFusion - Date and Time formatting is rounding up 5 minutes

查看:103
本文介绍了ColdFusion-日期和时间格式四舍五入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下日期字符串:

2017-05-02 08:00:00.0 

当我应用datetimeformat()时:

When I apply datetimeformat() like:

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

将其舍入5分钟并输出:8:05 AM。在上面的代码中, releasedate是传入的字符串。

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.

我该如何解决?

推荐答案

没有人舍入任何东西。您在这里输出的是 month 而不是分钟,而月份恰好是5月,因此是 05 前导零。

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 :月份为数字;

此处的分钟数不是 mm ,但是

Minutes are not mm here, but


nn :分钟;单位分钟的前导零

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

这篇关于ColdFusion-日期和时间格式四舍五入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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