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()): 23-Feb-19
DateFormat(now(),"mmm-dd-yyyy"):Feb-23-2019
 
DateFormat(now(),"m"): 2
DateFormat(now(),"mm"): 02
DateFormat(now(),"mmm"): Feb
DateFormat(now(),"mmmm"): February
 
DateFormat(now(),"d"): 23
DateFormat(now(),"dd"): 23
DateFormat(now(),"ddd"): Sat
DateFormat(now(),"dddd"): Saturday
 
DateFormat(now(),"y"): 19
DateFormat(now(),"yy"): 19
DateFormat(now(),"yyyy"): 2019
 
DateFormat(now(),"short"): 2/23/19
DateFormat(now(),"medium"): Feb 23, 2019
DateFormat(now(),"long"): February 23, 2019
DateFormat(now(),"full"): Saturday, February 23, 2019
 
TimeFormat(now()): 06:06 PM
TimeFormat(now(),"hh:mm:ss t"):06:06:44 P
TimeFormat(now(),"hh:mm:ss tt"):06:06:44 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"): 6
TimeFormat(now(),"mm"): 06
 
TimeFormat(now(),"s"): 44
TimeFormat(now(),"ss"): 44
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): P
TimeFormat(now(),"tt"): PM
 
TimeFormat(now(),"short"): 6:06 PM
TimeFormat(now(),"medium"): 6:06:44 PM
TimeFormat(now(),"long"): 6:06:44 PM EST
TimeFormat(now(),"full"): 6:06:44 PM EST



Time: 06:06 PM