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



Time: 03:02 PM