Re: Inputting relative datetimes - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: Inputting relative datetimes
Date
Msg-id CAEZATCUmzEb3Sfc6FfBMYZVX9qE2uN1hOoduXgo2UKRciNCj5A@mail.gmail.com
Whole thread Raw
In response to Re: Inputting relative datetimes  (Vik Reykja <vikreykja@gmail.com>)
Responses Re: Inputting relative datetimes
Re: Inputting relative datetimes
Re: Inputting relative datetimes
List pgsql-hackers
On 25 August 2011 10:43, Vik Reykja <vikreykja@gmail.com> wrote:
> On Thu, Aug 25, 2011 at 11:39, Dean Rasheed <dean.a.rasheed@gmail.com>
> wrote:
>>
>> My first thought was to have some general way of adding or subtracting
>> an interval at the end of an input timestamp, eg. by adding another
>> couple of special values - "plus <interval>" and "minus <interval>".
>> This would allow things like:
>>
>> TIMESTAMPTZ 'today minus 5 days'
>> TIMESTAMPTZ 'now plus 2 hours'
>
> Funny you should mention intervals...
>
> timestamptz 'today' - interval '5 days'
> timestamptz 'now' + interval '2 hours'
>

Yes, but what I am trying to achieve is a way of entering such
relative timestamps using a single input value, so that absolute and
relative timestamps can both be bound to a SQL query using just one
variable.

Regards,
Dean


pgsql-hackers by date:

Previous
From: Vik Reykja
Date:
Subject: Re: Inputting relative datetimes
Next
From: Robert Haas
Date:
Subject: Re: cheaper snapshots redux