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()): 06-Oct-22
DateFormat(now(),"mmm-dd-yyyy"):Oct-06-2022
 
DateFormat(now(),"m"): 10
DateFormat(now(),"mm"): 10
DateFormat(now(),"mmm"): Oct
DateFormat(now(),"mmmm"): October
 
DateFormat(now(),"d"): 6
DateFormat(now(),"dd"): 06
DateFormat(now(),"ddd"): Thu
DateFormat(now(),"dddd"): Thursday
 
DateFormat(now(),"y"): 2022
DateFormat(now(),"yy"): 22
DateFormat(now(),"yyyy"): 2022
 
DateFormat(now(),"short"): 10/6/22
DateFormat(now(),"medium"): Oct 6, 2022
DateFormat(now(),"long"): October 6, 2022
DateFormat(now(),"full"): Thursday, October 6, 2022
 
TimeFormat(now()): 04:26 AM
TimeFormat(now(),"hh:mm:ss t"):04:26:53 A
TimeFormat(now(),"hh:mm:ss tt"):04:26:53 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"): 26
TimeFormat(now(),"mm"): 26
 
TimeFormat(now(),"s"): 53
TimeFormat(now(),"ss"): 53
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): A
TimeFormat(now(),"tt"): AM
 
TimeFormat(now(),"short"): 4:26 AM
TimeFormat(now(),"medium"): 4:26:53 AM
TimeFormat(now(),"long"): 4:26:53 AM EDT
TimeFormat(now(),"full"): 4:26:53 AM EDT



Time: 04:26 AM