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()): 29-Sep-20
DateFormat(now(),"mmm-dd-yyyy"):Sep-29-2020
 
DateFormat(now(),"m"): 9
DateFormat(now(),"mm"): 09
DateFormat(now(),"mmm"): Sep
DateFormat(now(),"mmmm"): September
 
DateFormat(now(),"d"): 29
DateFormat(now(),"dd"): 29
DateFormat(now(),"ddd"): Tue
DateFormat(now(),"dddd"): Tuesday
 
DateFormat(now(),"y"): 20
DateFormat(now(),"yy"): 20
DateFormat(now(),"yyyy"): 2020
 
DateFormat(now(),"short"): 9/29/20
DateFormat(now(),"medium"): Sep 29, 2020
DateFormat(now(),"long"): September 29, 2020
DateFormat(now(),"full"): Tuesday, September 29, 2020
 
TimeFormat(now()): 11:33 AM
TimeFormat(now(),"hh:mm:ss t"):11:33:42 A
TimeFormat(now(),"hh:mm:ss tt"):11:33:42 AM
12 hour format
TimeFormat(now(),"h"): 11
TimeFormat(now(),"hh"): 11
24 hour format 00:00 to 23:00
TimeFormat(now(),"H"): 11
TimeFormat(now(),"HH"): 11
 
TimeFormat(now(),"m"): 33
TimeFormat(now(),"mm"): 33
 
TimeFormat(now(),"s"): 42
TimeFormat(now(),"ss"): 42
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): A
TimeFormat(now(),"tt"): AM
 
TimeFormat(now(),"short"): 11:33 AM
TimeFormat(now(),"medium"): 11:33:42 AM
TimeFormat(now(),"long"): 11:33:42 AM EDT
TimeFormat(now(),"full"): 11:33:42 AM EDT



Time: 11:33 AM