From: Peter Garner <peter_garner@yahoo.com>
To: Peter T Mount <peter@retep.org.uk>
To: Thomas G. Lockhart <lockhart@alumni.caltech.edu>
Cc: pgsql-interfaces@postgreSQL.org
Subject: Re: [INTERFACES] Re: ResultSet.getDate
Date: Mon, 1 Feb 1999 14:16:11 -0800 (PST)
Message-ID: <19990201221611.27552.rocketmail@send205.yahoomail.com> (raw)
Hi All! :-)
Here is an even better one for you! ;-) It seems that
Java, not JDBC is chopping the time portion in doing
the conversion from a java.util.Date to a java.sql.Date
(ResultSet.getDate converts them) Try the following,
please :
import java.sql.* ;
import java.text.* ;
import java.util.* ;
class DateTest
{
// Public Methods
public static void main ( String strgarrArgs [] )
{
try
{
SimpleDateFormat sdf = new SimpleDateFormat ( "dd MMM yyyy
HH:mm:ss" ) ;
java.util.Date date = new java.util.Date ( "01 Feb 1999
16:08:00" ) ;
System.out.println ( "\nDate is:\t" + sdf.format ( date ) ) ;
java.sql.Date sqldate = new java.sql.Date ( date.getTime ()
) ;
System.out.println ( "SQL Date is:\t" + sdf.format ( sqldate )
+ "\n" ) ;
} /* endtry */
catch ( Exception e )
{
System.out.println ( "\nCaught an Exception of type " +
e.getClass ().getName () ) ;
System.out.println ( e.getMessage () ) ;
} /* endcatch */
} /* static void main ( String strgarrArgs [] ) */
} /* class DateTest */
On my machine at least the output is :
Date is: 01 Feb 1999 16:08:00
SQL Date is: 01 Feb 1999 00:00:00
Looks like a definite bug in the JVM or just in the
Blackdown Linux v1.17 JVM! ;-) Thanks again!
==
Peace,
Peter
We are Microsoft of Borg, you will be assimilated!!!
Resistance is fut... ***BZZZRT*** THUD!!!
[General Protection Fault in MSBorg32.DLL]
Please contact the vendor for more information
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: peter_garner@yahoo.com, peter@retep.org.uk, lockhart@alumni.caltech.edu
Subject: Re: [INTERFACES] Re: ResultSet.getDate
In-Reply-To: <19990201221611.27552.rocketmail@send205.yahoomail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox