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



Time: 07:57 PM