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()): 14-May-21
DateFormat(now(),"mmm-dd-yyyy"):May-14-2021
 
DateFormat(now(),"m"): 5
DateFormat(now(),"mm"): 05
DateFormat(now(),"mmm"): May
DateFormat(now(),"mmmm"): May
 
DateFormat(now(),"d"): 14
DateFormat(now(),"dd"): 14
DateFormat(now(),"ddd"): Fri
DateFormat(now(),"dddd"): Friday
 
DateFormat(now(),"y"): 21
DateFormat(now(),"yy"): 21
DateFormat(now(),"yyyy"): 2021
 
DateFormat(now(),"short"): 5/14/21
DateFormat(now(),"medium"): May 14, 2021
DateFormat(now(),"long"): May 14, 2021
DateFormat(now(),"full"): Friday, May 14, 2021
 
TimeFormat(now()): 07:18 AM
TimeFormat(now(),"hh:mm:ss t"):07:18:34 A
TimeFormat(now(),"hh:mm:ss tt"):07:18:34 AM
12 hour format
TimeFormat(now(),"h"): 7
TimeFormat(now(),"hh"): 07
24 hour format 00:00 to 23:00
TimeFormat(now(),"H"): 7
TimeFormat(now(),"HH"): 07
 
TimeFormat(now(),"m"): 18
TimeFormat(now(),"mm"): 18
 
TimeFormat(now(),"s"): 34
TimeFormat(now(),"ss"): 34
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): A
TimeFormat(now(),"tt"): AM
 
TimeFormat(now(),"short"): 7:18 AM
TimeFormat(now(),"medium"): 7:18:34 AM
TimeFormat(now(),"long"): 7:18:34 AM EDT
TimeFormat(now(),"full"): 7:18:34 AM EDT



Time: 07:18 AM