Re: to_timestamp alternatives - Mailing list pgsql-general

From Jim Nasby
Subject Re: to_timestamp alternatives
Date
Msg-id 5685BE6F.9050504@BlueTreble.com
Whole thread Raw
In response to Re: to_timestamp alternatives  (gkhan <drjohnpayne@gmail.com>)
Responses Re: to_timestamp alternatives
List pgsql-general
On 12/31/15 5:05 PM, gkhan wrote:
> For
> example, this fails because of the day-before-month format:

Right, which is why Tom had in his example:

regression=# set datestyle = dmy;

BTW, my recommendation would be to store in a timestamptz field *with
the correct timezone*, and then convert on output as necessary. This is
easy to do by either

SET timezone

or

SELECT timestamptz_field AT TIME ZONE '...';

If you want the time without DST, you can just use a timezone like '+8'
or '-8'.

Since you're dealing with GPS data and presumably have lat/long, it
shouldn't be hard to do this dynamically either, either by just blindly
dividing longitude by 15 or using actual timezone shape polygons and @>
or <@.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com


pgsql-general by date:

Previous
From: gkhan
Date:
Subject: Re: to_timestamp alternatives
Next
From: Adrian Klaver
Date:
Subject: Re: to_timestamp alternatives