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()): 29-May-20
DateFormat(now(),"mmm-dd-yyyy"):May-29-2020
 
DateFormat(now(),"m"): 5
DateFormat(now(),"mm"): 05
DateFormat(now(),"mmm"): May
DateFormat(now(),"mmmm"): May
 
DateFormat(now(),"d"): 29
DateFormat(now(),"dd"): 29
DateFormat(now(),"ddd"): Fri
DateFormat(now(),"dddd"): Friday
 
DateFormat(now(),"y"): 20
DateFormat(now(),"yy"): 20
DateFormat(now(),"yyyy"): 2020
 
DateFormat(now(),"short"): 5/29/20
DateFormat(now(),"medium"): May 29, 2020
DateFormat(now(),"long"): May 29, 2020
DateFormat(now(),"full"): Friday, May 29, 2020
 
TimeFormat(now()): 06:35 PM
TimeFormat(now(),"hh:mm:ss t"):06:35:09 P
TimeFormat(now(),"hh:mm:ss tt"):06:35:09 PM
12 hour format
TimeFormat(now(),"h"): 6
TimeFormat(now(),"hh"): 06
24 hour format 00:00 to 23:00
TimeFormat(now(),"H"): 18
TimeFormat(now(),"HH"): 18
 
TimeFormat(now(),"m"): 35
TimeFormat(now(),"mm"): 35
 
TimeFormat(now(),"s"): 9
TimeFormat(now(),"ss"): 09
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): P
TimeFormat(now(),"tt"): PM
 
TimeFormat(now(),"short"): 6:35 PM
TimeFormat(now(),"medium"): 6:35:09 PM
TimeFormat(now(),"long"): 6:35:09 PM EDT
TimeFormat(now(),"full"): 6:35:09 PM EDT



Time: 06:35 PM