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()): 19-Apr-19
DateFormat(now(),"mmm-dd-yyyy"):Apr-19-2019
 
DateFormat(now(),"m"): 4
DateFormat(now(),"mm"): 04
DateFormat(now(),"mmm"): Apr
DateFormat(now(),"mmmm"): April
 
DateFormat(now(),"d"): 19
DateFormat(now(),"dd"): 19
DateFormat(now(),"ddd"): Fri
DateFormat(now(),"dddd"): Friday
 
DateFormat(now(),"y"): 19
DateFormat(now(),"yy"): 19
DateFormat(now(),"yyyy"): 2019
 
DateFormat(now(),"short"): 4/19/19
DateFormat(now(),"medium"): Apr 19, 2019
DateFormat(now(),"long"): April 19, 2019
DateFormat(now(),"full"): Friday, April 19, 2019
 
TimeFormat(now()): 12:35 AM
TimeFormat(now(),"hh:mm:ss t"):12:35:58 A
TimeFormat(now(),"hh:mm:ss tt"):12:35:58 AM
12 hour format
TimeFormat(now(),"h"): 12
TimeFormat(now(),"hh"): 12
24 hour format 00:00 to 23:00
TimeFormat(now(),"H"): 0
TimeFormat(now(),"HH"): 00
 
TimeFormat(now(),"m"): 35
TimeFormat(now(),"mm"): 35
 
TimeFormat(now(),"s"): 58
TimeFormat(now(),"ss"): 58
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): A
TimeFormat(now(),"tt"): AM
 
TimeFormat(now(),"short"): 12:35 AM
TimeFormat(now(),"medium"): 12:35:58 AM
TimeFormat(now(),"long"): 12:35:58 AM EDT
TimeFormat(now(),"full"): 12:35:58 AM EDT



Time: 12:35 AM