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-Jul-18
DateFormat(now(),"mmm-dd-yyyy"):Jul-19-2018
 
DateFormat(now(),"m"): 7
DateFormat(now(),"mm"): 07
DateFormat(now(),"mmm"): Jul
DateFormat(now(),"mmmm"): July
 
DateFormat(now(),"d"): 19
DateFormat(now(),"dd"): 19
DateFormat(now(),"ddd"): Thu
DateFormat(now(),"dddd"): Thursday
 
DateFormat(now(),"y"): 18
DateFormat(now(),"yy"): 18
DateFormat(now(),"yyyy"): 2018
 
DateFormat(now(),"short"): 7/19/18
DateFormat(now(),"medium"): Jul 19, 2018
DateFormat(now(),"long"): July 19, 2018
DateFormat(now(),"full"): Thursday, July 19, 2018
 
TimeFormat(now()): 03:22 AM
TimeFormat(now(),"hh:mm:ss t"):03:22:03 A
TimeFormat(now(),"hh:mm:ss tt"):03:22:03 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"): 22
TimeFormat(now(),"mm"): 22
 
TimeFormat(now(),"s"): 3
TimeFormat(now(),"ss"): 03
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): A
TimeFormat(now(),"tt"): AM
 
TimeFormat(now(),"short"): 3:22 AM
TimeFormat(now(),"medium"): 3:22:03 AM
TimeFormat(now(),"long"): 3:22:03 AM EDT
TimeFormat(now(),"full"): 3:22:03 AM EDT



Time: 03:22 AM