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-18
DateFormat(now(),"mmm-dd-yyyy"):Oct-22-2018
 
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"): Mon
DateFormat(now(),"dddd"): Monday
 
DateFormat(now(),"y"): 18
DateFormat(now(),"yy"): 18
DateFormat(now(),"yyyy"): 2018
 
DateFormat(now(),"short"): 10/22/18
DateFormat(now(),"medium"): Oct 22, 2018
DateFormat(now(),"long"): October 22, 2018
DateFormat(now(),"full"): Monday, October 22, 2018
 
TimeFormat(now()): 02:43 PM
TimeFormat(now(),"hh:mm:ss t"):02:43:14 P
TimeFormat(now(),"hh:mm:ss tt"):02:43:14 PM
12 hour format
TimeFormat(now(),"h"): 2
TimeFormat(now(),"hh"): 02
24 hour format 00:00 to 23:00
TimeFormat(now(),"H"): 14
TimeFormat(now(),"HH"): 14
 
TimeFormat(now(),"m"): 43
TimeFormat(now(),"mm"): 43
 
TimeFormat(now(),"s"): 14
TimeFormat(now(),"ss"): 14
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): P
TimeFormat(now(),"tt"): PM
 
TimeFormat(now(),"short"): 2:43 PM
TimeFormat(now(),"medium"): 2:43:14 PM
TimeFormat(now(),"long"): 2:43:14 PM EDT
TimeFormat(now(),"full"): 2:43:14 PM EDT



Time: 02:43 PM