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()): 20-Oct-17
DateFormat(now(),"mmm-dd-yyyy"):Oct-20-2017
 
DateFormat(now(),"m"): 10
DateFormat(now(),"mm"): 10
DateFormat(now(),"mmm"): Oct
DateFormat(now(),"mmmm"): October
 
DateFormat(now(),"d"): 20
DateFormat(now(),"dd"): 20
DateFormat(now(),"ddd"): Fri
DateFormat(now(),"dddd"): Friday
 
DateFormat(now(),"y"): 17
DateFormat(now(),"yy"): 17
DateFormat(now(),"yyyy"): 2017
 
DateFormat(now(),"short"): 10/20/17
DateFormat(now(),"medium"): Oct 20, 2017
DateFormat(now(),"long"): October 20, 2017
DateFormat(now(),"full"): Friday, October 20, 2017
 
TimeFormat(now()): 01:16 AM
TimeFormat(now(),"hh:mm:ss t"):01:16:13 A
TimeFormat(now(),"hh:mm:ss tt"):01:16:13 AM
12 hour format
TimeFormat(now(),"h"): 1
TimeFormat(now(),"hh"): 01
24 hour format 00:00 to 23:00
TimeFormat(now(),"H"): 1
TimeFormat(now(),"HH"): 01
 
TimeFormat(now(),"m"): 16
TimeFormat(now(),"mm"): 16
 
TimeFormat(now(),"s"): 13
TimeFormat(now(),"ss"): 13
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): A
TimeFormat(now(),"tt"): AM
 
TimeFormat(now(),"short"): 1:16 AM
TimeFormat(now(),"medium"): 1:16:13 AM
TimeFormat(now(),"long"): 1:16:13 AM EDT
TimeFormat(now(),"full"): 1:16:13 AM EDT



Time: 01:16 AM