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()): 28-Sep-20
DateFormat(now(),"mmm-dd-yyyy"):Sep-28-2020
 
DateFormat(now(),"m"): 9
DateFormat(now(),"mm"): 09
DateFormat(now(),"mmm"): Sep
DateFormat(now(),"mmmm"): September
 
DateFormat(now(),"d"): 28
DateFormat(now(),"dd"): 28
DateFormat(now(),"ddd"): Mon
DateFormat(now(),"dddd"): Monday
 
DateFormat(now(),"y"): 20
DateFormat(now(),"yy"): 20
DateFormat(now(),"yyyy"): 2020
 
DateFormat(now(),"short"): 9/28/20
DateFormat(now(),"medium"): Sep 28, 2020
DateFormat(now(),"long"): September 28, 2020
DateFormat(now(),"full"): Monday, September 28, 2020
 
TimeFormat(now()): 11:45 PM
TimeFormat(now(),"hh:mm:ss t"):11:45:53 P
TimeFormat(now(),"hh:mm:ss tt"):11:45:53 PM
12 hour format
TimeFormat(now(),"h"): 11
TimeFormat(now(),"hh"): 11
24 hour format 00:00 to 23:00
TimeFormat(now(),"H"): 23
TimeFormat(now(),"HH"): 23
 
TimeFormat(now(),"m"): 45
TimeFormat(now(),"mm"): 45
 
TimeFormat(now(),"s"): 53
TimeFormat(now(),"ss"): 53
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): P
TimeFormat(now(),"tt"): PM
 
TimeFormat(now(),"short"): 11:45 PM
TimeFormat(now(),"medium"): 11:45:53 PM
TimeFormat(now(),"long"): 11:45:53 PM EDT
TimeFormat(now(),"full"): 11:45:53 PM EDT



Time: 11:45 PM