Re: postgres UTC different from perl?

From: Richard Huxton <dev(at)archonet(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: postgres UTC different from perl?
Date: 2007-12-19 20:15:31
Message-ID: 47697BE3.2050008@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Louis-David Mitterrand wrote:
> Hi,
>
> when trying:
>
> psql template1 -c "select date_part('epoch',current_date at time zone 'UTC');"
> date_part
> ------------
> 1198015200
>
> the result is different from
>
> perl -MDateTime -le 'print DateTime->today(time_zone => "UTC")->epoch;'
> 1198022400
>
> Is there an issue with postgresql?

Well, there's one of 3 possibilities:

1. PostgreSQL's date/time code is broken.
2. Perl's DateTime module is broken.
3. One of those bits of code doesn't do what you think it does.

I'm not sure that (CURRENT_DATE AT TIME ZONE 'UTC') does what you think
it does. Try setting your timezone to various offsets and exploring.

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Robert Treat 2007-12-19 20:17:03 phpPgAdmin 4.2-Beta-1 translation status
Previous Message Marco Aurélio V. da Silva 2007-12-19 20:06:33 Re: Problem with collector statistic