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



Time: 09:03 AM