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()): 28-Jun-17
DateFormat(now(),"mmm-dd-yyyy"):Jun-28-2017
 
DateFormat(now(),"m"): 6
DateFormat(now(),"mm"): 06
DateFormat(now(),"mmm"): Jun
DateFormat(now(),"mmmm"): June
 
DateFormat(now(),"d"): 28
DateFormat(now(),"dd"): 28
DateFormat(now(),"ddd"): Wed
DateFormat(now(),"dddd"): Wednesday
 
DateFormat(now(),"y"): 17
DateFormat(now(),"yy"): 17
DateFormat(now(),"yyyy"): 2017
 
DateFormat(now(),"short"): 6/28/17
DateFormat(now(),"medium"): Jun 28, 2017
DateFormat(now(),"long"): June 28, 2017
DateFormat(now(),"full"): Wednesday, June 28, 2017
 
TimeFormat(now()): 10:06 PM
TimeFormat(now(),"hh:mm:ss t"):10:06:06 P
TimeFormat(now(),"hh:mm:ss tt"):10:06:06 PM
12 hour format
TimeFormat(now(),"h"): 10
TimeFormat(now(),"hh"): 10
24 hour format 00:00 to 23:00
TimeFormat(now(),"H"): 22
TimeFormat(now(),"HH"): 22
 
TimeFormat(now(),"m"): 6
TimeFormat(now(),"mm"): 06
 
TimeFormat(now(),"s"): 6
TimeFormat(now(),"ss"): 06
 
TimeFormat(now(),"1"): 1
 
TimeFormat(now(),"t"): P
TimeFormat(now(),"tt"): PM
 
TimeFormat(now(),"short"): 10:06 PM
TimeFormat(now(),"medium"): 10:06:06 PM
TimeFormat(now(),"long"): 10:06:06 PM EDT
TimeFormat(now(),"full"): 10:06:06 PM EDT



Time: 10:06 PM