Skip to main content
Petro_O__Bochan
Inspiring
June 29, 2012
Answered

DateTimeFormat

  • June 29, 2012
  • 1 reply
  • 1014 views

Hello guys, cf10 got this function introduced, but I'm getting sporadic behaviour with it.

----------------

<cfset n = Now() />

<cfoutput>#DateFormat(n, 'mmm dd, yyyy')# #TimeFormat(n, 'HH:mm:ss')#</cfoutput><br />

<cfoutput>#DateTimeFormat(n, 'mmm dd, yyyy HH:mm:ss')#</cfoutput><br />

<cfoutput>#n#</cfoutput>

----------------

Jun 29, 2012 03:48:11

Jun 29, 2012 03:06:11

{ts '2012-06-29 03:48:11'}

----------------

What’s going on? Where is that offset coming from? I tried the 3rd param as well, but to no avail. It’s not that I’m depended on this function, but this behaviour is not intuitive nor very portable.

Cheers,

Petro

This topic has been closed for replies.
Correct answer Adam Cameron.

Ask yerself these questions: "What do the docs say is the mask character for month?  And for minute?"

http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WSd8001ae4abdbd9112ab20a5d1350d854529-8000.html

--

And

1 reply

Adam Cameron.Correct answer
Inspiring
June 29, 2012

Ask yerself these questions: "What do the docs say is the mask character for month?  And for minute?"

http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WSd8001ae4abdbd9112ab20a5d1350d854529-8000.html

--

And

Petro_O__Bochan
Inspiring
June 29, 2012

<cfoutput>#DateTimeFormat(n, 'mmm dd, yyyy HH:nn:ss')#</cfoutput><br />

had to change mm to nn for minute. Thanks a bunch. That's a good habit to look up for comments right on the web though. Cheers.