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



Time: 12:10 PM