Re: tsrange format - Mailing list pgsql-general

From Adrian Klaver
Subject Re: tsrange format
Date
Msg-id 568986A5.7000102@aklaver.com
Whole thread Raw
In response to tsrange format  (Greg Jaskiewicz <gryzman@gmail.com>)
List pgsql-general
On 01/03/2016 11:40 AM, Greg Jaskiewicz wrote:
> Hi,
>
> Is it easily possible to supply and receive tsrange types in epoch values, or is it really all down always to string
parsing?

AFAIK, not without resorting to a using some mishmash of EXTRACT,
to_date() and casting.

> As a general rule, I pass time in the app in epoch-float values, which is then converted by the presenter/controller
layerto the right format used by views, whether that’s a html app or some other type of an app. After all, I don’t
alwaysneed the date in the YYYY-MM-DD format, and I want to be independent from the server configuration. Any wisdom on
thatfront please ? 

The way I do it, is I have a helper function that normalizes date/times
to one of two basic formats, mdy for users and iso for the internal Web
part(namely JavaScript). This is using Django and hence Python, where I
use the dateutil package(dateutil.readthedocs.org/en/latest/). It takes
care of all the ugliness of parsing date/time strings. I went this route
because dates and times can appear from a variety sources that are not
the database and which I have no control over.

>
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: "Steve Petrie, P.Eng."
Date:
Subject: Question -- Session Operations - Feasibility Of Proposed Synchronization Method?
Next
From: Pavel Stehule
Date:
Subject: Re: Question -- Session Operations - Feasibility Of Proposed Synchronization Method?