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-Nov-19
DateFormat(now(),"mmm-dd-yyyy"):Nov-22-2019
 
DateFormat(now(),"m"): 11
DateFormat(now(),"mm"): 11
DateFormat(now(),"mmm"): Nov
DateFormat(now(),"mmmm"): November
 
DateFormat(now(),"d"): 22
DateFormat(now(),"dd"): 22
DateFormat(now(),"ddd"): Fri
DateFormat(now(),"dddd"): Friday
 
DateFormat(now(),"y"): 19
DateFormat(now(),"yy"): 19
DateFormat(now(),"yyyy"): 2019
 
DateFormat(now(),"short"): 11/22/19
DateFormat(now(),"medium"): Nov 22, 2019
DateFormat(now(),"long"): November 22, 2019
DateFormat(now(),"full"): Friday, November 22, 2019
 
TimeFormat(now()): 07:15 PM
TimeFormat(now(),"hh:mm:ss t"):07:15:43 P
TimeFormat(now(),"hh:mm:ss tt"):07:15:43 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"): 15
TimeFormat(now(),"mm"): 15
 
TimeFormat(now(),"s"): 43
TimeFormat(now(),"ss"): 43
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): P
TimeFormat(now(),"tt"): PM
 
TimeFormat(now(),"short"): 7:15 PM
TimeFormat(now(),"medium"): 7:15:43 PM
TimeFormat(now(),"long"): 7:15:43 PM EST
TimeFormat(now(),"full"): 7:15:43 PM EST



Time: 07:15 PM