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()): 31-May-20
DateFormat(now(),"mmm-dd-yyyy"):May-31-2020
 
DateFormat(now(),"m"): 5
DateFormat(now(),"mm"): 05
DateFormat(now(),"mmm"): May
DateFormat(now(),"mmmm"): May
 
DateFormat(now(),"d"): 31
DateFormat(now(),"dd"): 31
DateFormat(now(),"ddd"): Sun
DateFormat(now(),"dddd"): Sunday
 
DateFormat(now(),"y"): 20
DateFormat(now(),"yy"): 20
DateFormat(now(),"yyyy"): 2020
 
DateFormat(now(),"short"): 5/31/20
DateFormat(now(),"medium"): May 31, 2020
DateFormat(now(),"long"): May 31, 2020
DateFormat(now(),"full"): Sunday, May 31, 2020
 
TimeFormat(now()): 03:54 AM
TimeFormat(now(),"hh:mm:ss t"):03:54:00 A
TimeFormat(now(),"hh:mm:ss tt"):03:54:00 AM
12 hour format
TimeFormat(now(),"h"): 3
TimeFormat(now(),"hh"): 03
24 hour format 00:00 to 23:00
TimeFormat(now(),"H"): 3
TimeFormat(now(),"HH"): 03
 
TimeFormat(now(),"m"): 54
TimeFormat(now(),"mm"): 54
 
TimeFormat(now(),"s"): 0
TimeFormat(now(),"ss"): 00
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): A
TimeFormat(now(),"tt"): AM
 
TimeFormat(now(),"short"): 3:54 AM
TimeFormat(now(),"medium"): 3:54:00 AM
TimeFormat(now(),"long"): 3:54:00 AM EDT
TimeFormat(now(),"full"): 3:54:00 AM EDT



Time: 03:54 AM