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()): 24-Sep-18
DateFormat(now(),"mmm-dd-yyyy"):Sep-24-2018
 
DateFormat(now(),"m"): 9
DateFormat(now(),"mm"): 09
DateFormat(now(),"mmm"): Sep
DateFormat(now(),"mmmm"): September
 
DateFormat(now(),"d"): 24
DateFormat(now(),"dd"): 24
DateFormat(now(),"ddd"): Mon
DateFormat(now(),"dddd"): Monday
 
DateFormat(now(),"y"): 18
DateFormat(now(),"yy"): 18
DateFormat(now(),"yyyy"): 2018
 
DateFormat(now(),"short"): 9/24/18
DateFormat(now(),"medium"): Sep 24, 2018
DateFormat(now(),"long"): September 24, 2018
DateFormat(now(),"full"): Monday, September 24, 2018
 
TimeFormat(now()): 04:14 PM
TimeFormat(now(),"hh:mm:ss t"):04:14:07 P
TimeFormat(now(),"hh:mm:ss tt"):04:14:07 PM
12 hour format
TimeFormat(now(),"h"): 4
TimeFormat(now(),"hh"): 04
24 hour format 00:00 to 23:00
TimeFormat(now(),"H"): 16
TimeFormat(now(),"HH"): 16
 
TimeFormat(now(),"m"): 14
TimeFormat(now(),"mm"): 14
 
TimeFormat(now(),"s"): 7
TimeFormat(now(),"ss"): 07
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): P
TimeFormat(now(),"tt"): PM
 
TimeFormat(now(),"short"): 4:14 PM
TimeFormat(now(),"medium"): 4:14:07 PM
TimeFormat(now(),"long"): 4:14:07 PM EDT
TimeFormat(now(),"full"): 4:14:07 PM EDT



Time: 04:14 PM