From: | Peter Mount <petermount(at)it(dot)maidstone(dot)gov(dot)uk> |
---|---|
To: | Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>, "Adam H(dot) Pendleton" <apendleton(at)vgsinc(dot)com> |
Cc: | pgsql-interfaces(at)hub(dot)org |
Subject: | RE: [INTERFACES] Java and PGSQL date question |
Date: | 1999-05-11 10:11:42 |
Message-ID: | A9DCBD548069D211924000C00D001C442352BC@exchange.maidstone.gov.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
I didn't see the original message, but the correct way to send Java
dates to psql is to use a PreparedStatement, and the setDate() method.
Formatting dates manually, and sending to a Statement may work, but then
you'll fall fowl of the DateStyle settings.
PS: I'm still testing some modifications to the date routines in the
driver.
--
Peter T Mount, IT Section
petermount(at)it(dot)maidstone(dot)gov(dot)uk
Anything I write here are my own views, and cannot be taken as the
official words of Maidstone Borough Council
-----Original Message-----
From: Thomas Lockhart [mailto:lockhart(at)alumni(dot)caltech(dot)edu]
Sent: Monday, May 10, 1999 7:04 PM
To: Adam H. Pendleton
Cc: pgsql-interfaces(at)hub(dot)org
Subject: Re: [INTERFACES] Java and PGSQL date question
> I am trying to pass a date from Java into a PostgreSQL database. I am
using
> the DateFormat.parse() funcitonality to format the date. However, the
> database doesn't want to take it? I looked at the PGSQL documentation
and
> it says that the default date type is postgresql date type, which is:
Wed
> Dec 17 07:37:16 1997 PST. Java is sending the date in this format:
Wed Dec
> 17 07:37:16 PST 1997. How do I make this work. Is it easier to
change the
> Java format or the PGSQL format?
postgres=> select 'Wed Dec 17 07:37:16 PST 1997'::datetime;
?column?
----------------------------
Wed Dec 17 15:37:16 1997 UTC
(1 row)
Looks good to me. Does this work from psql on your db? If so, then the
problem lies elsewhere...
- Tom
--
Thomas Lockhart lockhart(at)alumni(dot)caltech(dot)edu
South Pasadena, California
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Tong | 1999-05-11 12:50:07 | Re: [INTERFACES] Bug in psql? |
Previous Message | Herouth Maoz | 1999-05-11 09:16:50 | Re: [INTERFACES] How to store ' |