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()): 19-Oct-20
DateFormat(now(),"mmm-dd-yyyy"):Oct-19-2020
 
DateFormat(now(),"m"): 10
DateFormat(now(),"mm"): 10
DateFormat(now(),"mmm"): Oct
DateFormat(now(),"mmmm"): October
 
DateFormat(now(),"d"): 19
DateFormat(now(),"dd"): 19
DateFormat(now(),"ddd"): Mon
DateFormat(now(),"dddd"): Monday
 
DateFormat(now(),"y"): 20
DateFormat(now(),"yy"): 20
DateFormat(now(),"yyyy"): 2020
 
DateFormat(now(),"short"): 10/19/20
DateFormat(now(),"medium"): Oct 19, 2020
DateFormat(now(),"long"): October 19, 2020
DateFormat(now(),"full"): Monday, October 19, 2020
 
TimeFormat(now()): 10:47 PM
TimeFormat(now(),"hh:mm:ss t"):10:47:41 P
TimeFormat(now(),"hh:mm:ss tt"):10:47:41 PM
12 hour format
TimeFormat(now(),"h"): 10
TimeFormat(now(),"hh"): 10
24 hour format 00:00 to 23:00
TimeFormat(now(),"H"): 22
TimeFormat(now(),"HH"): 22
 
TimeFormat(now(),"m"): 47
TimeFormat(now(),"mm"): 47
 
TimeFormat(now(),"s"): 41
TimeFormat(now(),"ss"): 41
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): P
TimeFormat(now(),"tt"): PM
 
TimeFormat(now(),"short"): 10:47 PM
TimeFormat(now(),"medium"): 10:47:41 PM
TimeFormat(now(),"long"): 10:47:41 PM EDT
TimeFormat(now(),"full"): 10:47:41 PM EDT



Time: 10:47 PM