Re: datetime JDBC date conversion

From: Joe Weinstein (joeNOSPAM_at_bea.com)
Date: 10/27/04


Date: Tue, 26 Oct 2004 15:10:29 -0700
To: billb <kmilburn@austin.rr.com>


billb wrote:

> 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?

Are you sure you tried getTimestamp()?
Joe Weinstein at BEA



Relevant Pages

  • Re: Application Speed Problem - VERY weird
    ... MDE front ends not MDB ... If the DB is reading in a lot of records, ... The data is linked with the standard Access "link ... add that we have only ever used the database on Access 2K. ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Help with calculations in a query
    ... Well, Richard, I'll tell you what I do know. ... I do know that I've tried various approaches to solving many database ... deletes the row containing the previous day's reading? ... Lets say that I created an extra field in my table for each meter ...
    (microsoft.public.access.queries)
  • Re: using files with java
    ... >> Basically all you need is a File object and print and read Streams, ... > Are you trying to build a database in Java? ... > reading and PrintWriter, BufferedOutputStream, and FileOutputStream for ... Serialization is okay...commonly used in clustering, ...
    (comp.lang.java.programmer)
  • Re: using files with java
    ... >> Basically all you need is a File object and print and read Streams, ... > Are you trying to build a database in Java? ... > reading and PrintWriter, BufferedOutputStream, and FileOutputStream for ... Serialization is okay...commonly used in clustering, ...
    (comp.lang.java.help)
  • Re: Setting the data type of a new filed in a make table query
    ... I have created a small database that has ... wanted to populate the form with all of the equipment that needed an hour ... reading, display the LAST reading and add ... possible with a Select query, or if I can provide you with some additional ...
    (microsoft.public.access.queries)