Обсуждение: jbuilder and timestamps

Поиск
Список
Период
Сортировка

jbuilder and timestamps

От
miguel angel rojas aquino
Дата:
hi everybody, hope any one can give me some insigth about this one, we
are in great despair :(

we are developing an application using jbuilder 5 and postgresql
7.2.2-1PGDG, and found some strange beheavior with the timestamps, say
for example, in our database we have a record like this one:

          id_emp | name             |      date
--------+--------+------------------------
              1004 |  laura              | 2002-09-19 00:00:00-05

but when displaying this same date in a textfield in our application, it
says the date is 2002-09-18 23:00:00!!!!

the date field is a timestamp with time zone, we tried using a timestamp
without time zone, but our app starts complaining about not finding a
timestamp data type :(

it gets worst as we need the right date to make some calculations about
the number of days between dates.

when querying this same database using SquirrelSQL (a java database
client), the date apperas correctly as is in the database, so i think
the problem is with the borland dataexpress components, but i'm not
sure, so if somebody got the same problems, it would be greatly
appreciated if can share the solution

many thanks in advance, and best regards


Re: jbuilder and timestamps

От
Andrew Sullivan
Дата:
On Fri, Nov 01, 2002 at 04:09:44PM -0600, miguel angel rojas aquino wrote:
> we are developing an application using jbuilder 5 and postgresql
> 7.2.2-1PGDG, and found some strange beheavior with the timestamps, say
> for example, in our database we have a record like this one:
>
>           id_emp | name             |      date
> --------+--------+------------------------
>               1004 |  laura              | 2002-09-19 00:00:00-05
>
> but when displaying this same date in a textfield in our application, it
> says the date is 2002-09-18 23:00:00!!!!

It sounds like your PGTZ setting is wrong somewhere.  In your case,
it appears you want Eastern time.  So make sure that your PGTZ
setting is EST5EDT.

A

----
Andrew Sullivan                         204-4141 Yonge Street
Liberty RMS                           Toronto, Ontario Canada
<andrew@libertyrms.info>                              M2P 2A8
                                         +1 416 646 3304 x110


Re: jbuilder and timestamps

От
Barry Lind
Дата:
What version of the driver are you using?  I would suggest trying the
7.3beta3 driver as there have been some fixes in timestamp handling
since 7.2.  You can get the latest driver from http://jdbc.postgresql.org

You really haven't provided enough information about the problem.  What
you are reporting seems like the correct behavior.  You have a value
stored in the database of 2002-09-19 00:00:00-05 (or 2002-09-19
05:00:00-00) and you are displaying that value in an application where
the timezone setting is -06, thus you end up seeing 2002-09-18
23:00:00-06 (of course your app is using a display format that doesn't
include the timezone so you really only see 2002-09-18 23:00:00)

So it seems to me that everything is behaving correctly.

thanks,
--Barry



miguel angel rojas aquino wrote:
> hi everybody, hope any one can give me some insigth about this one, we
> are in great despair :(
>
> we are developing an application using jbuilder 5 and postgresql
> 7.2.2-1PGDG, and found some strange beheavior with the timestamps, say
> for example, in our database we have a record like this one:
>
>          id_emp | name             |      date
> --------+--------+------------------------
>              1004 |  laura              | 2002-09-19 00:00:00-05
>
> but when displaying this same date in a textfield in our application, it
> says the date is 2002-09-18 23:00:00!!!!
>
> the date field is a timestamp with time zone, we tried using a timestamp
> without time zone, but our app starts complaining about not finding a
> timestamp data type :(
>
> it gets worst as we need the right date to make some calculations about
> the number of days between dates.
>
> when querying this same database using SquirrelSQL (a java database
> client), the date apperas correctly as is in the database, so i think
> the problem is with the borland dataexpress components, but i'm not
> sure, so if somebody got the same problems, it would be greatly
> appreciated if can share the solution
>
> many thanks in advance, and best regards
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>