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()): 24-Jan-18
DateFormat(now(),"mmm-dd-yyyy"):Jan-24-2018
 
DateFormat(now(),"m"): 1
DateFormat(now(),"mm"): 01
DateFormat(now(),"mmm"): Jan
DateFormat(now(),"mmmm"): January
 
DateFormat(now(),"d"): 24
DateFormat(now(),"dd"): 24
DateFormat(now(),"ddd"): Wed
DateFormat(now(),"dddd"): Wednesday
 
DateFormat(now(),"y"): 18
DateFormat(now(),"yy"): 18
DateFormat(now(),"yyyy"): 2018
 
DateFormat(now(),"short"): 1/24/18
DateFormat(now(),"medium"): Jan 24, 2018
DateFormat(now(),"long"): January 24, 2018
DateFormat(now(),"full"): Wednesday, January 24, 2018
 
TimeFormat(now()): 02:03 AM
TimeFormat(now(),"hh:mm:ss t"):02:03:42 A
TimeFormat(now(),"hh:mm:ss tt"):02:03:42 AM
12 hour format
TimeFormat(now(),"h"): 2
TimeFormat(now(),"hh"): 02
24 hour format 00:00 to 23:00
TimeFormat(now(),"H"): 2
TimeFormat(now(),"HH"): 02
 
TimeFormat(now(),"m"): 3
TimeFormat(now(),"mm"): 03
 
TimeFormat(now(),"s"): 42
TimeFormat(now(),"ss"): 42
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): A
TimeFormat(now(),"tt"): AM
 
TimeFormat(now(),"short"): 2:03 AM
TimeFormat(now(),"medium"): 2:03:42 AM
TimeFormat(now(),"long"): 2:03:42 AM EST
TimeFormat(now(),"full"): 2:03:42 AM EST



Time: 02:03 AM