I am trying to clean up my Date/TimeStamp before I show it to the user on the page.
I am pulling the following information from a database MSSQL and it is stored in the myDate variable:
#myDate# = 2015-06-10 11:47:00.0
What I would like to do is cleanup myDate
so that is looks like this:
2015-06-10 11:47
I have explored using Left
but I believe that only works for strings.
I am not 100% sure how this is accomplished in ColdFusion.
Thanks let me know if more information is needed.
If you are using CF9 or below, you can use
dateFormat()
andtimeFormat()
functions to accomplish it. Like this.In case you want to display time in 24 hour format you can use
HH
as mask intimeFormat()
function. For more details go through these links:DateFormat()
TimeFormat()
If you are using CF10 or above then, as @Leigh suggested, you can use
dateTimeFormat()
function. Like this.Where
nn
is the mask for displaying minutes. For more options go through the link @Leigh suggested.