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()): 10-Aug-20
DateFormat(now(),"mmm-dd-yyyy"):Aug-10-2020
 
DateFormat(now(),"m"): 8
DateFormat(now(),"mm"): 08
DateFormat(now(),"mmm"): Aug
DateFormat(now(),"mmmm"): August
 
DateFormat(now(),"d"): 10
DateFormat(now(),"dd"): 10
DateFormat(now(),"ddd"): Mon
DateFormat(now(),"dddd"): Monday
 
DateFormat(now(),"y"): 20
DateFormat(now(),"yy"): 20
DateFormat(now(),"yyyy"): 2020
 
DateFormat(now(),"short"): 8/10/20
DateFormat(now(),"medium"): Aug 10, 2020
DateFormat(now(),"long"): August 10, 2020
DateFormat(now(),"full"): Monday, August 10, 2020
 
TimeFormat(now()): 08:33 AM
TimeFormat(now(),"hh:mm:ss t"):08:33:13 A
TimeFormat(now(),"hh:mm:ss tt"):08:33:13 AM
12 hour format
TimeFormat(now(),"h"): 8
TimeFormat(now(),"hh"): 08
24 hour format 00:00 to 23:00
TimeFormat(now(),"H"): 8
TimeFormat(now(),"HH"): 08
 
TimeFormat(now(),"m"): 33
TimeFormat(now(),"mm"): 33
 
TimeFormat(now(),"s"): 13
TimeFormat(now(),"ss"): 13
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): A
TimeFormat(now(),"tt"): AM
 
TimeFormat(now(),"short"): 8:33 AM
TimeFormat(now(),"medium"): 8:33:13 AM
TimeFormat(now(),"long"): 8:33:13 AM EDT
TimeFormat(now(),"full"): 8:33:13 AM EDT



Time: 08:33 AM