JesseEarley
JesseEarley

Reputation: 1032

ColdFusion - Date and Time formatting is rounding up 5 minutes

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?

Upvotes: 1

Views: 321

Answers (1)

C3roe
C3roe

Reputation: 96306

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

Upvotes: 13

Related Questions