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()): 12-Dec-17
DateFormat(now(),"mmm-dd-yyyy"):Dec-12-2017
 
DateFormat(now(),"m"): 12
DateFormat(now(),"mm"): 12
DateFormat(now(),"mmm"): Dec
DateFormat(now(),"mmmm"): December
 
DateFormat(now(),"d"): 12
DateFormat(now(),"dd"): 12
DateFormat(now(),"ddd"): Tue
DateFormat(now(),"dddd"): Tuesday
 
DateFormat(now(),"y"): 17
DateFormat(now(),"yy"): 17
DateFormat(now(),"yyyy"): 2017
 
DateFormat(now(),"short"): 12/12/17
DateFormat(now(),"medium"): Dec 12, 2017
DateFormat(now(),"long"): December 12, 2017
DateFormat(now(),"full"): Tuesday, December 12, 2017
 
TimeFormat(now()): 07:14 AM
TimeFormat(now(),"hh:mm:ss t"):07:14:34 A
TimeFormat(now(),"hh:mm:ss tt"):07:14:34 AM
12 hour format
TimeFormat(now(),"h"): 7
TimeFormat(now(),"hh"): 07
24 hour format 00:00 to 23:00
TimeFormat(now(),"H"): 7
TimeFormat(now(),"HH"): 07
 
TimeFormat(now(),"m"): 14
TimeFormat(now(),"mm"): 14
 
TimeFormat(now(),"s"): 34
TimeFormat(now(),"ss"): 34
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): A
TimeFormat(now(),"tt"): AM
 
TimeFormat(now(),"short"): 7:14 AM
TimeFormat(now(),"medium"): 7:14:34 AM
TimeFormat(now(),"long"): 7:14:34 AM EST
TimeFormat(now(),"full"): 7:14:34 AM EST



Time: 07:14 AM