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()): 22-Oct-19
DateFormat(now(),"mmm-dd-yyyy"):Oct-22-2019
 
DateFormat(now(),"m"): 10
DateFormat(now(),"mm"): 10
DateFormat(now(),"mmm"): Oct
DateFormat(now(),"mmmm"): October
 
DateFormat(now(),"d"): 22
DateFormat(now(),"dd"): 22
DateFormat(now(),"ddd"): Tue
DateFormat(now(),"dddd"): Tuesday
 
DateFormat(now(),"y"): 19
DateFormat(now(),"yy"): 19
DateFormat(now(),"yyyy"): 2019
 
DateFormat(now(),"short"): 10/22/19
DateFormat(now(),"medium"): Oct 22, 2019
DateFormat(now(),"long"): October 22, 2019
DateFormat(now(),"full"): Tuesday, October 22, 2019
 
TimeFormat(now()): 06:44 PM
TimeFormat(now(),"hh:mm:ss t"):06:44:47 P
TimeFormat(now(),"hh:mm:ss tt"):06:44:47 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"): 44
TimeFormat(now(),"mm"): 44
 
TimeFormat(now(),"s"): 47
TimeFormat(now(),"ss"): 47
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): P
TimeFormat(now(),"tt"): PM
 
TimeFormat(now(),"short"): 6:44 PM
TimeFormat(now(),"medium"): 6:44:47 PM
TimeFormat(now(),"long"): 6:44:47 PM EDT
TimeFormat(now(),"full"): 6:44:47 PM EDT



Time: 06:44 PM