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



Time: 10:12 AM