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



Time: 03:04 AM