I am trying to use the ColdFusion DateFormat function. Can someone tell me why to do this:
#DateFormat( now(), "YYYY-MM-DD HH:MM:SS")#
returns this:
2012-07-17 16:07:666
Why 666 milliseconds? something diabolical ???
DateFormat does not format time. Use TimeFormat for time.
Edit
Use this code to display the date and time.
#dateFormat(now(),'YYYY-MM-DD')# #timeFormat(now(), 'HH:MM:SS')#
I prefer to use Java SimpleDateFormat, where the date mask is case sensitive.
<cfscript> createObject('java','java.text.SimpleDateFormat').init('yyyy-MM-dd HH:mm:ss.SSS').format(now()); </cfscript>
http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html
eg. 2010-07-19 11:46:12.029
2010-07-19 11:46:12.029