Help displaying time retrieved from a database field
Posted on 2004-10-15
I have a SQL 2000 database that in one of my columns I record a date and time. The sql format looks like:
10/15/2004 8:00:00 AM
When I retrieve this data to view in a JSP page I get:
Fri Oct 15 00:00:00 EDT 2004
I am not concerned with formatting right now as I have that much figured out but what my issue is I need the actual hh:mm:ss that were entered into the database to display. For some reason my time is reset to midnight regardless of the entry I make.
My current display is without formatting but this is what I will use to just display the time entered:
<% SimpleDateFormat dt = new SimpleDateFormat ("hh:mm:ss a"); %>
This works fine in displaying the time but it always reads 12:00:00 AM regradless of the entry in the database.
Any suggestions on where I could be going wrong in retrieving the time?