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()): 26-Apr-18
DateFormat(now(),"mmm-dd-yyyy"):Apr-26-2018
 
DateFormat(now(),"m"): 4
DateFormat(now(),"mm"): 04
DateFormat(now(),"mmm"): Apr
DateFormat(now(),"mmmm"): April
 
DateFormat(now(),"d"): 26
DateFormat(now(),"dd"): 26
DateFormat(now(),"ddd"): Thu
DateFormat(now(),"dddd"): Thursday
 
DateFormat(now(),"y"): 18
DateFormat(now(),"yy"): 18
DateFormat(now(),"yyyy"): 2018
 
DateFormat(now(),"short"): 4/26/18
DateFormat(now(),"medium"): Apr 26, 2018
DateFormat(now(),"long"): April 26, 2018
DateFormat(now(),"full"): Thursday, April 26, 2018
 
TimeFormat(now()): 11:03 PM
TimeFormat(now(),"hh:mm:ss t"):11:03:39 P
TimeFormat(now(),"hh:mm:ss tt"):11:03:39 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"): 3
TimeFormat(now(),"mm"): 03
 
TimeFormat(now(),"s"): 39
TimeFormat(now(),"ss"): 39
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): P
TimeFormat(now(),"tt"): PM
 
TimeFormat(now(),"short"): 11:03 PM
TimeFormat(now(),"medium"): 11:03:39 PM
TimeFormat(now(),"long"): 11:03:39 PM EDT
TimeFormat(now(),"full"): 11:03:39 PM EDT



Time: 11:03 PM