[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 479
  • Last Modified:

CFML dateFormat to include hours, seconds, and am/pm

I am trying to format a timestamp which reads:

3/16/2010 11:12:00 AM in the database (SQL).

In ColdFusion if I know I use #dateFormat(variable, "mm/dd/yyyy")# to get 03/15/2010, but how do I include the hours, minutes, seconds, and am/pm?  I tried #dateFormat(variable, "mm/dd/yyyy hh:mm:ss")# and it doesn't appear to be giving the right information.
0
traport
Asked:
traport
2 Solutions
 
_agx_Commented:
DateFormat() only formats _dates_.  You need to use two functions: DateFormat() for the date part and TimeFormat() for the time part.  

#DateFormat(variable, "mm/dd/yyyy")#
#TimeFormat(variable, "hh:mm:ss tt")#
0
 
erikTsomikSystem Architect, CF programmer Commented:
can use this format
#DateFormat(now(),"mm/dd/yyyy")# #TimeFormat(now(), "h:mm tt")#
0
 
traportAuthor Commented:
Thanks ya'll!
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now