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()): 15-Dec-19
DateFormat(now(),"mmm-dd-yyyy"):Dec-15-2019
 
DateFormat(now(),"m"): 12
DateFormat(now(),"mm"): 12
DateFormat(now(),"mmm"): Dec
DateFormat(now(),"mmmm"): December
 
DateFormat(now(),"d"): 15
DateFormat(now(),"dd"): 15
DateFormat(now(),"ddd"): Sun
DateFormat(now(),"dddd"): Sunday
 
DateFormat(now(),"y"): 19
DateFormat(now(),"yy"): 19
DateFormat(now(),"yyyy"): 2019
 
DateFormat(now(),"short"): 12/15/19
DateFormat(now(),"medium"): Dec 15, 2019
DateFormat(now(),"long"): December 15, 2019
DateFormat(now(),"full"): Sunday, December 15, 2019
 
TimeFormat(now()): 10:36 AM
TimeFormat(now(),"hh:mm:ss t"):10:36:24 A
TimeFormat(now(),"hh:mm:ss tt"):10:36:24 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"): 36
TimeFormat(now(),"mm"): 36
 
TimeFormat(now(),"s"): 24
TimeFormat(now(),"ss"): 24
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): A
TimeFormat(now(),"tt"): AM
 
TimeFormat(now(),"short"): 10:36 AM
TimeFormat(now(),"medium"): 10:36:24 AM
TimeFormat(now(),"long"): 10:36:24 AM EST
TimeFormat(now(),"full"): 10:36:24 AM EST



Time: 10:36 AM