Thread: Re: [INTERFACES] ResultSet.getDate

Re: [INTERFACES] ResultSet.getDate

From
"Tim Joyce"
Date:
> > Peter,
> >
> > >The date and time methods are being rewritten for 6.6 as they can't
handle
> > >some of the different time zones.
> >
> > Thanks, can I set postgres to pass dates to JDBC in a format that it can
> > understand?
>
> The SET DATESTYLE statement can be used to force the backend to return
> dates in a particular format. The best one being ISO.

This problem is still causing me headaches, I can change the timezone for
the session:

finsbury=> select current_timestamp ;
?column?
----------------------
1999-11-15 06:57:38-05
(1 row)

finsbury=> set timezone='gmt';
SET VARIABLE

finsbury=> select current_timestamp ;
?column?
----------------------
1999-11-15 11:58:37+00
(1 row)

And also for the postgres user (by setting PGTZ=GMT in.bash_profile),
But how do I set the timezone when I start postgres so that dates are always
reported in GMT?

postgresql 6.4
RH6

TIA

timj






Re: [INTERFACES] ResultSet.getDate

From
"Tim Joyce"
Date:
Further to below,

I am now setting TZ=GMT PGDATESTYLE=ISO on postmaster startup:

finsbury=> select current_timestamp;
?column?
----------------------
1999-11-15 15:27:24+00
(1 row)

, but am still getting

- java.sql.SQLException: Bad Timestamp Format: at 0 in 1999-11-12 17:36:5EST

from the jdbc driver.

thanks for any help

timj

> > >
> > > >The date and time methods are being rewritten for 6.6 as they can't
> handle
> > > >some of the different time zones.
> > >
> > > Thanks, can I set postgres to pass dates to JDBC in a format that it
can
> > > understand?
> >
> > The SET DATESTYLE statement can be used to force the backend to return
> > dates in a particular format. The best one being ISO.
>
> This problem is still causing me headaches, I can change the timezone for
> the session:
>
> finsbury=> select current_timestamp ;
> ?column?
> ----------------------
> 1999-11-15 06:57:38-05
> (1 row)
>
> finsbury=> set timezone='gmt';
> SET VARIABLE
>
> finsbury=> select current_timestamp ;
> ?column?
> ----------------------
> 1999-11-15 11:58:37+00
> (1 row)
>
> And also for the postgres user (by setting PGTZ=GMT in.bash_profile),
> But how do I set the timezone when I start postgres so that dates are
always
> reported in GMT?
>
> postgresql 6.4
> RH6
>
> TIA
>
> timj
>
>
>
>
>
> ************



Re: [INTERFACES] ResultSet.getDate

From
Tom Lane
Date:
"Tim Joyce" <tim@hoop.co.uk> writes:
> But how do I set the timezone when I start postgres so that dates are always
> reported in GMT?

TZ when the postmaster is started sets the default zone, I believe.
There is no way to make it "always" report in GMT, if by that you
mean overriding clients' PGTZ settings.
        regards, tom lane


Re: [INTERFACES] ResultSet.getDate

From
"Tim Joyce"
Date:

> "Tim Joyce" <tim@hoop.co.uk> writes:
> > But how do I set the timezone when I start postgres so that dates are
always
> > reported in GMT?
>
> TZ when the postmaster is started sets the default zone, I believe.
> There is no way to make it "always" report in GMT, if by that you
> mean overriding clients' PGTZ settings.

thanks, but what is then the best way of avoiding the following exception:

java.sql.SQLException: Bad Timestamp Format: at 0 in 1999-11-12 17:36:5EST

cheers

timj




Re: [INTERFACES] ResultSet.getDate

From
Oscar Serrano
Date:
Hi:
I'm from Spain. I've exported some tables from MS Access to Postgres. You
know, in Spain, a number like this: 1,234.56 me write it like this:
1.234,56
i.e., the thousand separator is the "." and the decimal separator is the ","

I'm going to use Perl (DBI) to get the data from the databases.
Is there anyway so DBI or postgress gives me the data in the spanish format?

I wouldn't like to use somethink like this:
$result=~s/\./,/g;
to convert all "." to "," and vice-versa.

Thanks



--
______________________________

Oscar Serrano

http://www.fondos.net
http://www.mercados.net