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-Sep-18
DateFormat(now(),"mmm-dd-yyyy"):Sep-22-2018
 
DateFormat(now(),"m"): 9
DateFormat(now(),"mm"): 09
DateFormat(now(),"mmm"): Sep
DateFormat(now(),"mmmm"): September
 
DateFormat(now(),"d"): 22
DateFormat(now(),"dd"): 22
DateFormat(now(),"ddd"): Sat
DateFormat(now(),"dddd"): Saturday
 
DateFormat(now(),"y"): 18
DateFormat(now(),"yy"): 18
DateFormat(now(),"yyyy"): 2018
 
DateFormat(now(),"short"): 9/22/18
DateFormat(now(),"medium"): Sep 22, 2018
DateFormat(now(),"long"): September 22, 2018
DateFormat(now(),"full"): Saturday, September 22, 2018
 
TimeFormat(now()): 03:27 AM
TimeFormat(now(),"hh:mm:ss t"):03:27:51 A
TimeFormat(now(),"hh:mm:ss tt"):03:27:51 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"): 27
TimeFormat(now(),"mm"): 27
 
TimeFormat(now(),"s"): 51
TimeFormat(now(),"ss"): 51
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): A
TimeFormat(now(),"tt"): AM
 
TimeFormat(now(),"short"): 3:27 AM
TimeFormat(now(),"medium"): 3:27:51 AM
TimeFormat(now(),"long"): 3:27:51 AM EDT
TimeFormat(now(),"full"): 3:27:51 AM EDT



Time: 03:27 AM