How do I display time in Coldfusion 8 from Oracle 10g

We have an Oracle 10g database that has a table that stores a date. The date feild is populated from a web app that is run on ColdFusion 6 MX and then retreived and displayed on another web page that is run on ColdFusion 8. For some reason the time displayed is defaulting to 12:00 AM. The date displays correctly but not the time. The applications running on ColdFusion 6 MX do not have this problem and the time will display correctly i.e. 11:55 PM. Any ideas on how to make this work without changing the database and front end application? Here is the display code I am using. I have tried a bunch of formats but still only get 12:00 AM for the time.
<cfquery name="rsDateLastMod" datasource="plowout">
SELECT	datDate
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<body bgcolor="#000066" background="images/blue_back.gif">
<table border="0" cellpadding="0" cellspacing="0">
		<td><font color="white" face="arial" size="2"><b>The Map is current as of <cfoutput>#DateFormat(rsDateLastMod.datdate, "m/d/yy")#</cfoutput> 

Open in new window

Who is Participating?
gdemariaConnect With a Mentor Commented:
Seems Oracle is not using the conventional ODBC date that Coldfusion expects.

The work-around is to specify the date in a TO_CHAR() function in the SELECT statement to convert it to the string when fetching...


select to_char(sDateLastMod.datdate, 'HH:MI')  as theTime


there are some issues with 10g & jdbc (but I don't think that's the issue)

probably just need to specify the mask explcitly


or if you want the whole date/time string

#dateformat(rsDateLastMod.datdate,"dd/mm/yyyy hh:mm:ss")#
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

You should also verify that the full date and time are actually in the database.   You can do this by querying the data in SQL*Plus.  Sometimes the problem is getting the full date/time into the database... instead of getting it out.
apwbeAuthor Commented:
Attached is a screen shot of the data field and value. I would be real happy if I could just display the information like this.
Ok, good.  That eliminates the question of being in the database.

Did you try Sid's suggested format?    #timeformat(rsDateLastMod.datdate,"h:mm")#

apwbeAuthor Commented:
Yes, I tried Sid's format and got basicall the same results ..12:00..I am at a real loss on this one.
apwbeAuthor Commented:
I got it to work. The final code:

SELECT to_char(datdate, 'Day DD Month YYYY HH24:MI:SS') as theTime


      The Map is current as of  #rsDateLastMod.theTime#

This displays:
"The Map is current as of Tuesday 28 April 2009 13:48:01"
Thanks for the help and good luck.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.