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()): 17-Nov-19
DateFormat(now(),"mmm-dd-yyyy"):Nov-17-2019
 
DateFormat(now(),"m"): 11
DateFormat(now(),"mm"): 11
DateFormat(now(),"mmm"): Nov
DateFormat(now(),"mmmm"): November
 
DateFormat(now(),"d"): 17
DateFormat(now(),"dd"): 17
DateFormat(now(),"ddd"): Sun
DateFormat(now(),"dddd"): Sunday
 
DateFormat(now(),"y"): 19
DateFormat(now(),"yy"): 19
DateFormat(now(),"yyyy"): 2019
 
DateFormat(now(),"short"): 11/17/19
DateFormat(now(),"medium"): Nov 17, 2019
DateFormat(now(),"long"): November 17, 2019
DateFormat(now(),"full"): Sunday, November 17, 2019
 
TimeFormat(now()): 12:19 PM
TimeFormat(now(),"hh:mm:ss t"):12:19:38 P
TimeFormat(now(),"hh:mm:ss tt"):12:19:38 PM
12 hour format
TimeFormat(now(),"h"): 12
TimeFormat(now(),"hh"): 12
24 hour format 00:00 to 23:00
TimeFormat(now(),"H"): 12
TimeFormat(now(),"HH"): 12
 
TimeFormat(now(),"m"): 19
TimeFormat(now(),"mm"): 19
 
TimeFormat(now(),"s"): 38
TimeFormat(now(),"ss"): 38
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): P
TimeFormat(now(),"tt"): PM
 
TimeFormat(now(),"short"): 12:19 PM
TimeFormat(now(),"medium"): 12:19:38 PM
TimeFormat(now(),"long"): 12:19:38 PM EST
TimeFormat(now(),"full"): 12:19:38 PM EST



Time: 12:19 PM