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()): 26-May-24
DateFormat(now(),"mmm-dd-yyyy"):May-26-2024
 
DateFormat(now(),"m"): 5
DateFormat(now(),"mm"): 05
DateFormat(now(),"mmm"): May
DateFormat(now(),"mmmm"): May
 
DateFormat(now(),"d"): 26
DateFormat(now(),"dd"): 26
DateFormat(now(),"ddd"): Sun
DateFormat(now(),"dddd"): Sunday
 
DateFormat(now(),"y"): 2024
DateFormat(now(),"yy"): 24
DateFormat(now(),"yyyy"): 2024
 
DateFormat(now(),"short"): 5/26/24
DateFormat(now(),"medium"): May 26, 2024
DateFormat(now(),"long"): May 26, 2024
DateFormat(now(),"full"): Sunday, May 26, 2024
 
TimeFormat(now()): 12:06 PM
TimeFormat(now(),"hh:mm:ss t"):12:06:23 P
TimeFormat(now(),"hh:mm:ss tt"):12:06:23 PM
12 hour format
TimeFormat(now(),"h"): 12
TimeFormat(now(),"hh"): 12
24 hour format 00:00 to 23:00
TimeFormat(now(),"H"): 12
TimeFormat(now(),"HH"): 12
 
TimeFormat(now(),"m"): 6
TimeFormat(now(),"mm"): 06
 
TimeFormat(now(),"s"): 23
TimeFormat(now(),"ss"): 23
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): P
TimeFormat(now(),"tt"): PM
 
TimeFormat(now(),"short"): 12:06 PM
TimeFormat(now(),"medium"): 12:06:23 PM
TimeFormat(now(),"long"): 12:06:23 PM EDT
TimeFormat(now(),"full"): 12:06:23 PM EDT



Time: 12:06 PM