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



Time: 01:44 AM