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()): 09-Oct-26
DateFormat(now(),"mmm-dd-yyyy"):Oct-09-2026
 
DateFormat(now(),"m"): 10
DateFormat(now(),"mm"): 10
DateFormat(now(),"mmm"): Oct
DateFormat(now(),"mmmm"): October
 
DateFormat(now(),"d"): 9
DateFormat(now(),"dd"): 09
DateFormat(now(),"ddd"): Fri
DateFormat(now(),"dddd"): Friday
 
DateFormat(now(),"y"): 2026
DateFormat(now(),"yy"): 26
DateFormat(now(),"yyyy"): 2026
 
DateFormat(now(),"short"): 10/9/26
DateFormat(now(),"medium"): Oct 9, 2026
DateFormat(now(),"long"): October 9, 2026
DateFormat(now(),"full"): Friday, October 9, 2026
 
TimeFormat(now()): 04:29 AM
TimeFormat(now(),"hh:mm:ss t"):04:29:20 A
TimeFormat(now(),"hh:mm:ss tt"):04:29:20 AM
12 hour format
TimeFormat(now(),"h"): 4
TimeFormat(now(),"hh"): 04
24 hour format 00:00 to 23:00
TimeFormat(now(),"H"): 4
TimeFormat(now(),"HH"): 04
 
TimeFormat(now(),"m"): 29
TimeFormat(now(),"mm"): 29
 
TimeFormat(now(),"s"): 20
TimeFormat(now(),"ss"): 20
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): A
TimeFormat(now(),"tt"): AM
 
TimeFormat(now(),"short"): 4:29 AM
TimeFormat(now(),"medium"): 4:29:20 AM
TimeFormat(now(),"long"): 4:29:20 AM EDT
TimeFormat(now(),"full"): 4:29:20 AM EDT



Time: 04:29 AM