Reputation: 492
DATEFORMAT(Now(),"yyyy-mm-dd HH:mm:ss.SSS")
When using the code above, ColdFusion always returns the time as 12 minutes past the hour. The rest of the date / time is correct, but the MINUTES are always set at 12 past.
At 2011-12-14 14:02:36.020 returned result is 2011-12-14 14:12:36.020
At 2011-12-14 13:27:09.783 returned result is 2011-12-14 13:12:09.783
Can anyone explain why? I remember reading something about this in the past, but right now I am pulling a blank.
Upvotes: 3
Views: 8970
Reputation: 9
In Coldfusion, mm
represents the month instead of minutes. Use nn
instead of mm
:
DATEFORMAT(Now(),"yyyy-mm-dd", "HH:nn:ss.L")
Upvotes: 0
Reputation: 2706
It's not now() that's incorrect, it's your formatting. You need to use dateformat() and timeformat() like this:
dateFormat(Now(),"yyyy-mm-dd") & " " & timeFormat(now(), "HH:mm:ss.SSS")
Upvotes: 15