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()): 16-Jan-19
DateFormat(now(),"mmm-dd-yyyy"):Jan-16-2019
 
DateFormat(now(),"m"): 1
DateFormat(now(),"mm"): 01
DateFormat(now(),"mmm"): Jan
DateFormat(now(),"mmmm"): January
 
DateFormat(now(),"d"): 16
DateFormat(now(),"dd"): 16
DateFormat(now(),"ddd"): Wed
DateFormat(now(),"dddd"): Wednesday
 
DateFormat(now(),"y"): 19
DateFormat(now(),"yy"): 19
DateFormat(now(),"yyyy"): 2019
 
DateFormat(now(),"short"): 1/16/19
DateFormat(now(),"medium"): Jan 16, 2019
DateFormat(now(),"long"): January 16, 2019
DateFormat(now(),"full"): Wednesday, January 16, 2019
 
TimeFormat(now()): 12:52 AM
TimeFormat(now(),"hh:mm:ss t"):12:52:35 A
TimeFormat(now(),"hh:mm:ss tt"):12:52:35 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"): 52
TimeFormat(now(),"mm"): 52
 
TimeFormat(now(),"s"): 35
TimeFormat(now(),"ss"): 35
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): A
TimeFormat(now(),"tt"): AM
 
TimeFormat(now(),"short"): 12:52 AM
TimeFormat(now(),"medium"): 12:52:35 AM
TimeFormat(now(),"long"): 12:52:35 AM EST
TimeFormat(now(),"full"): 12:52:35 AM EST



Time: 12:52 AM