truncation - Remove last 5 characters in string - ColdFusion -
i trying clean date/timestamp before show user on page.
i pulling following information database mssql , stored in mydate variable:
#mydate# = 2015-06-10 11:47:00.0
what cleanup mydate
looks this:
2015-06-10 11:47
i have explored using left
believe works strings.
i not 100% sure how accomplished in coldfusion.
thanks let me know if more information needed.
if using cf9 or below, can use dateformat()
, timeformat()
functions accomplish it. this.
<cfoutput> #dateformat(mydate, "yyyy-mm-dd")# #timeformat(mydate, "hh:mm")# </cfoutput>
in case want display time in 24 hour format can use hh
mask in timeformat()
function. more details go through these links:
if using cf10 or above then, @leigh suggested, can use datetimeformat()
function. this.
<cfoutput> #datetimeformat(mydate, "yyyy-mm-dd hh:nn")# </cfoutput>
where nn
mask displaying minutes. more options go through link @leigh suggested.
Comments
Post a Comment