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()): 18-Oct-18
DateFormat(now(),"mmm-dd-yyyy"):Oct-18-2018
 
DateFormat(now(),"m"): 10
DateFormat(now(),"mm"): 10
DateFormat(now(),"mmm"): Oct
DateFormat(now(),"mmmm"): October
 
DateFormat(now(),"d"): 18
DateFormat(now(),"dd"): 18
DateFormat(now(),"ddd"): Thu
DateFormat(now(),"dddd"): Thursday
 
DateFormat(now(),"y"): 18
DateFormat(now(),"yy"): 18
DateFormat(now(),"yyyy"): 2018
 
DateFormat(now(),"short"): 10/18/18
DateFormat(now(),"medium"): Oct 18, 2018
DateFormat(now(),"long"): October 18, 2018
DateFormat(now(),"full"): Thursday, October 18, 2018
 
TimeFormat(now()): 08:29 AM
TimeFormat(now(),"hh:mm:ss t"):08:29:15 A
TimeFormat(now(),"hh:mm:ss tt"):08:29:15 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"): 29
TimeFormat(now(),"mm"): 29
 
TimeFormat(now(),"s"): 15
TimeFormat(now(),"ss"): 15
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): A
TimeFormat(now(),"tt"): AM
 
TimeFormat(now(),"short"): 8:29 AM
TimeFormat(now(),"medium"): 8:29:15 AM
TimeFormat(now(),"long"): 8:29:15 AM EDT
TimeFormat(now(),"full"): 8:29:15 AM EDT



Time: 08:29 AM