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-17
DateFormat(now(),"mmm-dd-yyyy"):Nov-17-2017
 
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"): Fri
DateFormat(now(),"dddd"): Friday
 
DateFormat(now(),"y"): 17
DateFormat(now(),"yy"): 17
DateFormat(now(),"yyyy"): 2017
 
DateFormat(now(),"short"): 11/17/17
DateFormat(now(),"medium"): Nov 17, 2017
DateFormat(now(),"long"): November 17, 2017
DateFormat(now(),"full"): Friday, November 17, 2017
 
TimeFormat(now()): 06:07 PM
TimeFormat(now(),"hh:mm:ss t"):06:07:36 P
TimeFormat(now(),"hh:mm:ss tt"):06:07:36 PM
12 hour format
TimeFormat(now(),"h"): 6
TimeFormat(now(),"hh"): 06
24 hour format 00:00 to 23:00
TimeFormat(now(),"H"): 18
TimeFormat(now(),"HH"): 18
 
TimeFormat(now(),"m"): 7
TimeFormat(now(),"mm"): 07
 
TimeFormat(now(),"s"): 36
TimeFormat(now(),"ss"): 36
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): P
TimeFormat(now(),"tt"): PM
 
TimeFormat(now(),"short"): 6:07 PM
TimeFormat(now(),"medium"): 6:07:36 PM
TimeFormat(now(),"long"): 6:07:36 PM EST
TimeFormat(now(),"full"): 6:07:36 PM EST



Time: 06:07 PM