datetime JDBC date conversion

From: billb (kmilburn_at_austin.rr.com)
Date: 10/26/04


Date: 26 Oct 2004 11:50:45 -0700

I am writing a datetime field value to MS SQL Server 7 in the following manner
via a stored procedure:

// item to be written is originally a java.util.Date object
java.util.Date fromDate;
// I'm inserting it here into the database
cstmt.setTimestamp(8, new Timestamp(fromDate.getTime()));

// the record in the database appears as follows - as I wanted it to..
12/23/2004 4:30:43 AM

The problem is reading the date FROM the database back into ANY type of Java
Date-related object. No matter what I try, the hour/minutes/seconds are not
returned, and I desperately need the hour and minutes. I don't want to store
the hours and minutes in another field - it just causes more complications.
Does anyone out there know a way to get the ENTIRE date value out of the database?



Relevant Pages

  • Re: Date vs DateTime
    ... The reason why the WHEREs will not handle our DateTime is that the database ... holds accurate information down to the 6th sig decimal figure on the ... and a DateTime field was set by the other application, ... it does make a difference when you are specifing them as ...
    (microsoft.public.dotnet.framework)
  • Re: Extracting Time from the SQL DateTime field.
    ... > Any help on extracting the time part from the datetime field in SQL ... > even though i had entered only the time part in the database when i ... > Visit Topic URL to contact author (reg. ...
    (comp.databases.ms-sqlserver)
  • Re: Concurrency violation
    ... datetime field and the dataset. ... the database, it compares its "Original data"of the row with what is in ... datetime values only upto second. ...
    (microsoft.public.dotnet.languages.csharp)
  • Extracting Time from the SQL DateTime field.
    ... Any help on extracting the time part from the datetime field in SQL ... even though i had entered only the time part in the database when i ...
    (comp.databases.ms-sqlserver)
  • Re: Concurrency violation
    ... database, it compares its "Original data"of the row with what is in the ... This comparison always result in difference in the datetime field. ... oAdapter.UpdateCommand.CommandText is like: "update aTable set ...
    (microsoft.public.dotnet.languages.csharp)