nope_four
nope_four

Reputation: 492

Coldfusion Now() Returning The Wrong Minutes

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.

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

Answers (2)

Goutham Pulipati
Goutham Pulipati

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

Barry Jordan
Barry Jordan

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

Related Questions