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-18
DateFormat(now(),"mmm-dd-yyyy"):Dec-12-2018
 
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"): Wed
DateFormat(now(),"dddd"): Wednesday
 
DateFormat(now(),"y"): 18
DateFormat(now(),"yy"): 18
DateFormat(now(),"yyyy"): 2018
 
DateFormat(now(),"short"): 12/12/18
DateFormat(now(),"medium"): Dec 12, 2018
DateFormat(now(),"long"): December 12, 2018
DateFormat(now(),"full"): Wednesday, December 12, 2018
 
TimeFormat(now()): 08:49 PM
TimeFormat(now(),"hh:mm:ss t"):08:49:45 P
TimeFormat(now(),"hh:mm:ss tt"):08:49:45 PM
12 hour format
TimeFormat(now(),"h"): 8
TimeFormat(now(),"hh"): 08
24 hour format 00:00 to 23:00
TimeFormat(now(),"H"): 20
TimeFormat(now(),"HH"): 20
 
TimeFormat(now(),"m"): 49
TimeFormat(now(),"mm"): 49
 
TimeFormat(now(),"s"): 45
TimeFormat(now(),"ss"): 45
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): P
TimeFormat(now(),"tt"): PM
 
TimeFormat(now(),"short"): 8:49 PM
TimeFormat(now(),"medium"): 8:49:45 PM
TimeFormat(now(),"long"): 8:49:45 PM EST
TimeFormat(now(),"full"): 8:49:45 PM EST



Time: 08:49 PM