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()): 30-May-17
DateFormat(now(),"mmm-dd-yyyy"):May-30-2017
 
DateFormat(now(),"m"): 5
DateFormat(now(),"mm"): 05
DateFormat(now(),"mmm"): May
DateFormat(now(),"mmmm"): May
 
DateFormat(now(),"d"): 30
DateFormat(now(),"dd"): 30
DateFormat(now(),"ddd"): Tue
DateFormat(now(),"dddd"): Tuesday
 
DateFormat(now(),"y"): 17
DateFormat(now(),"yy"): 17
DateFormat(now(),"yyyy"): 2017
 
DateFormat(now(),"short"): 5/30/17
DateFormat(now(),"medium"): May 30, 2017
DateFormat(now(),"long"): May 30, 2017
DateFormat(now(),"full"): Tuesday, May 30, 2017
 
TimeFormat(now()): 08:49 AM
TimeFormat(now(),"hh:mm:ss t"):08:49:13 A
TimeFormat(now(),"hh:mm:ss tt"):08:49:13 AM
12 hour format
TimeFormat(now(),"h"): 8
TimeFormat(now(),"hh"): 08
24 hour format 00:00 to 23:00
TimeFormat(now(),"H"): 8
TimeFormat(now(),"HH"): 08
 
TimeFormat(now(),"m"): 49
TimeFormat(now(),"mm"): 49
 
TimeFormat(now(),"s"): 13
TimeFormat(now(),"ss"): 13
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): A
TimeFormat(now(),"tt"): AM
 
TimeFormat(now(),"short"): 8:49 AM
TimeFormat(now(),"medium"): 8:49:13 AM
TimeFormat(now(),"long"): 8:49:13 AM EDT
TimeFormat(now(),"full"): 8:49:13 AM EDT



Time: 08:49 AM