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()): 28-Feb-20
DateFormat(now(),"mmm-dd-yyyy"):Feb-28-2020
 
DateFormat(now(),"m"): 2
DateFormat(now(),"mm"): 02
DateFormat(now(),"mmm"): Feb
DateFormat(now(),"mmmm"): February
 
DateFormat(now(),"d"): 28
DateFormat(now(),"dd"): 28
DateFormat(now(),"ddd"): Fri
DateFormat(now(),"dddd"): Friday
 
DateFormat(now(),"y"): 20
DateFormat(now(),"yy"): 20
DateFormat(now(),"yyyy"): 2020
 
DateFormat(now(),"short"): 2/28/20
DateFormat(now(),"medium"): Feb 28, 2020
DateFormat(now(),"long"): February 28, 2020
DateFormat(now(),"full"): Friday, February 28, 2020
 
TimeFormat(now()): 06:16 AM
TimeFormat(now(),"hh:mm:ss t"):06:16:22 A
TimeFormat(now(),"hh:mm:ss tt"):06:16:22 AM
12 hour format
TimeFormat(now(),"h"): 6
TimeFormat(now(),"hh"): 06
24 hour format 00:00 to 23:00
TimeFormat(now(),"H"): 6
TimeFormat(now(),"HH"): 06
 
TimeFormat(now(),"m"): 16
TimeFormat(now(),"mm"): 16
 
TimeFormat(now(),"s"): 22
TimeFormat(now(),"ss"): 22
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): A
TimeFormat(now(),"tt"): AM
 
TimeFormat(now(),"short"): 6:16 AM
TimeFormat(now(),"medium"): 6:16:22 AM
TimeFormat(now(),"long"): 6:16:22 AM EST
TimeFormat(now(),"full"): 6:16:22 AM EST



Time: 06:16 AM