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()): 14-Dec-18
DateFormat(now(),"mmm-dd-yyyy"):Dec-14-2018
 
DateFormat(now(),"m"): 12
DateFormat(now(),"mm"): 12
DateFormat(now(),"mmm"): Dec
DateFormat(now(),"mmmm"): December
 
DateFormat(now(),"d"): 14
DateFormat(now(),"dd"): 14
DateFormat(now(),"ddd"): Fri
DateFormat(now(),"dddd"): Friday
 
DateFormat(now(),"y"): 18
DateFormat(now(),"yy"): 18
DateFormat(now(),"yyyy"): 2018
 
DateFormat(now(),"short"): 12/14/18
DateFormat(now(),"medium"): Dec 14, 2018
DateFormat(now(),"long"): December 14, 2018
DateFormat(now(),"full"): Friday, December 14, 2018
 
TimeFormat(now()): 10:35 PM
TimeFormat(now(),"hh:mm:ss t"):10:35:01 P
TimeFormat(now(),"hh:mm:ss tt"):10:35:01 PM
12 hour format
TimeFormat(now(),"h"): 10
TimeFormat(now(),"hh"): 10
24 hour format 00:00 to 23:00
TimeFormat(now(),"H"): 22
TimeFormat(now(),"HH"): 22
 
TimeFormat(now(),"m"): 35
TimeFormat(now(),"mm"): 35
 
TimeFormat(now(),"s"): 1
TimeFormat(now(),"ss"): 01
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): P
TimeFormat(now(),"tt"): PM
 
TimeFormat(now(),"short"): 10:35 PM
TimeFormat(now(),"medium"): 10:35:01 PM
TimeFormat(now(),"long"): 10:35:01 PM EST
TimeFormat(now(),"full"): 10:35:01 PM EST



Time: 10:35 PM