DATE and TIME formatting code examples

"now()" returns the current system time. You can replace "now()" with any valid date field. For example:
     <cfset MyDateTimeNow = now()>
     #DateFormat(MyDateTimeNow,"mm-dd-yy")#


DateFormat(now()): 19-Oct-17
DateFormat(now(),"mmm-dd-yyyy"):Oct-19-2017
 
DateFormat(now(),"m"): 10
DateFormat(now(),"mm"): 10
DateFormat(now(),"mmm"): Oct
DateFormat(now(),"mmmm"): October
 
DateFormat(now(),"d"): 19
DateFormat(now(),"dd"): 19
DateFormat(now(),"ddd"): Thu
DateFormat(now(),"dddd"): Thursday
 
DateFormat(now(),"y"): 17
DateFormat(now(),"yy"): 17
DateFormat(now(),"yyyy"): 2017
 
DateFormat(now(),"short"): 10/19/17
DateFormat(now(),"medium"): Oct 19, 2017
DateFormat(now(),"long"): October 19, 2017
DateFormat(now(),"full"): Thursday, October 19, 2017
 
TimeFormat(now()): 10:33 AM
TimeFormat(now(),"hh:mm:ss t"):10:33:12 A
TimeFormat(now(),"hh:mm:ss tt"):10:33:12 AM
12 hour format
TimeFormat(now(),"h"): 10
TimeFormat(now(),"hh"): 10
24 hour format 00:00 to 23:00
TimeFormat(now(),"H"): 10
TimeFormat(now(),"HH"): 10
 
TimeFormat(now(),"m"): 33
TimeFormat(now(),"mm"): 33
 
TimeFormat(now(),"s"): 12
TimeFormat(now(),"ss"): 12
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): A
TimeFormat(now(),"tt"): AM
 
TimeFormat(now(),"short"): 10:33 AM
TimeFormat(now(),"medium"): 10:33:12 AM
TimeFormat(now(),"long"): 10:33:12 AM EDT
TimeFormat(now(),"full"): 10:33:12 AM EDT



Time: 10:33 AM