Re: to_timestamp alternatives

Поиск
Список
Период
Сортировка
От Jim Nasby
Тема Re: to_timestamp alternatives
Дата
Msg-id 5685BE6F.9050504@BlueTreble.com
обсуждение исходный текст
Ответ на Re: to_timestamp alternatives  (gkhan <drjohnpayne@gmail.com>)
Ответы Re: to_timestamp alternatives  (Alban Hertroys <haramrae@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: gkhan
Дата:
Сообщение: Re: to_timestamp alternatives
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: to_timestamp alternatives