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()): 20-Sep-19
DateFormat(now(),"mmm-dd-yyyy"):Sep-20-2019
 
DateFormat(now(),"m"): 9
DateFormat(now(),"mm"): 09
DateFormat(now(),"mmm"): Sep
DateFormat(now(),"mmmm"): September
 
DateFormat(now(),"d"): 20
DateFormat(now(),"dd"): 20
DateFormat(now(),"ddd"): Fri
DateFormat(now(),"dddd"): Friday
 
DateFormat(now(),"y"): 19
DateFormat(now(),"yy"): 19
DateFormat(now(),"yyyy"): 2019
 
DateFormat(now(),"short"): 9/20/19
DateFormat(now(),"medium"): Sep 20, 2019
DateFormat(now(),"long"): September 20, 2019
DateFormat(now(),"full"): Friday, September 20, 2019
 
TimeFormat(now()): 12:07 AM
TimeFormat(now(),"hh:mm:ss t"):12:07:01 A
TimeFormat(now(),"hh:mm:ss tt"):12:07:01 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"): 7
TimeFormat(now(),"mm"): 07
 
TimeFormat(now(),"s"): 1
TimeFormat(now(),"ss"): 01
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): A
TimeFormat(now(),"tt"): AM
 
TimeFormat(now(),"short"): 12:07 AM
TimeFormat(now(),"medium"): 12:07:01 AM
TimeFormat(now(),"long"): 12:07:01 AM EDT
TimeFormat(now(),"full"): 12:07:01 AM EDT



Time: 12:07 AM