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()): 03-Jul-20
DateFormat(now(),"mmm-dd-yyyy"):Jul-03-2020
 
DateFormat(now(),"m"): 7
DateFormat(now(),"mm"): 07
DateFormat(now(),"mmm"): Jul
DateFormat(now(),"mmmm"): July
 
DateFormat(now(),"d"): 3
DateFormat(now(),"dd"): 03
DateFormat(now(),"ddd"): Fri
DateFormat(now(),"dddd"): Friday
 
DateFormat(now(),"y"): 20
DateFormat(now(),"yy"): 20
DateFormat(now(),"yyyy"): 2020
 
DateFormat(now(),"short"): 7/3/20
DateFormat(now(),"medium"): Jul 3, 2020
DateFormat(now(),"long"): July 3, 2020
DateFormat(now(),"full"): Friday, July 3, 2020
 
TimeFormat(now()): 07:12 AM
TimeFormat(now(),"hh:mm:ss t"):07:12:45 A
TimeFormat(now(),"hh:mm:ss tt"):07:12:45 AM
12 hour format
TimeFormat(now(),"h"): 7
TimeFormat(now(),"hh"): 07
24 hour format 00:00 to 23:00
TimeFormat(now(),"H"): 7
TimeFormat(now(),"HH"): 07
 
TimeFormat(now(),"m"): 12
TimeFormat(now(),"mm"): 12
 
TimeFormat(now(),"s"): 45
TimeFormat(now(),"ss"): 45
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): A
TimeFormat(now(),"tt"): AM
 
TimeFormat(now(),"short"): 7:12 AM
TimeFormat(now(),"medium"): 7:12:45 AM
TimeFormat(now(),"long"): 7:12:45 AM EDT
TimeFormat(now(),"full"): 7:12:45 AM EDT



Time: 07:12 AM