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



Time: 09:23 AM