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()): 05-Dec-20
DateFormat(now(),"mmm-dd-yyyy"):Dec-05-2020
 
DateFormat(now(),"m"): 12
DateFormat(now(),"mm"): 12
DateFormat(now(),"mmm"): Dec
DateFormat(now(),"mmmm"): December
 
DateFormat(now(),"d"): 5
DateFormat(now(),"dd"): 05
DateFormat(now(),"ddd"): Sat
DateFormat(now(),"dddd"): Saturday
 
DateFormat(now(),"y"): 20
DateFormat(now(),"yy"): 20
DateFormat(now(),"yyyy"): 2020
 
DateFormat(now(),"short"): 12/5/20
DateFormat(now(),"medium"): Dec 5, 2020
DateFormat(now(),"long"): December 5, 2020
DateFormat(now(),"full"): Saturday, December 5, 2020
 
TimeFormat(now()): 12:13 AM
TimeFormat(now(),"hh:mm:ss t"):12:13:21 A
TimeFormat(now(),"hh:mm:ss tt"):12:13:21 AM
12 hour format
TimeFormat(now(),"h"): 12
TimeFormat(now(),"hh"): 12
24 hour format 00:00 to 23:00
TimeFormat(now(),"H"): 0
TimeFormat(now(),"HH"): 00
 
TimeFormat(now(),"m"): 13
TimeFormat(now(),"mm"): 13
 
TimeFormat(now(),"s"): 21
TimeFormat(now(),"ss"): 21
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): A
TimeFormat(now(),"tt"): AM
 
TimeFormat(now(),"short"): 12:13 AM
TimeFormat(now(),"medium"): 12:13:21 AM
TimeFormat(now(),"long"): 12:13:21 AM EST
TimeFormat(now(),"full"): 12:13:21 AM EST



Time: 12:13 AM