Skip site navigation (1) Skip section navigation (2)

Re: [QUESTIONS] select date('now'::datetime+'30 day'::timespan)

From: Brett McCormick <brett(at)abraxas(dot)scene(dot)com>
To: "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>
Cc: pgsql-questions(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [QUESTIONS] select date('now'::datetime+'30 day'::timespan)
Date: 1998-01-28 00:03:42
Message-ID: 199801280003.QAA11790@abraxas.scene.com (view raw or flat)
Thread:
Lists: pgsql-hackers
I was just using 30 days because that's what the previous fellow used..
it works, but some of the time conversion routines are still messed up.

select date('now'::datetime),date(datetime(date('now'::datetime)));
      date|      date
----------+----------
01-27-1998|01-26-1998
(1 row)

those should be the same correct?  it appears to get messed up in the
datetime(date) conversion..

--brett

On Tue, 27 January 1998, at 08:21:22, Thomas G. Lockhart wrote:

> btw, if you want to add a month, better to use
> 
> postgres=> select date( cast 'now'::date as datetime + '1
> month'::timespan);
>       date
> ----------
> 02-27-1998
> (1 row)
> 
> (The important thing is the '1 month' time span; ignore the casting
> until v6.3 :)

Responses

pgsql-hackers by date

Next:From: Bruce MomjianDate: 1998-01-28 02:30:53
Subject: deadlocks
Previous:From: Brett McCormickDate: 1998-01-27 23:57:00
Subject: Re: [HACKERS] A small type extension example for the contrib directory (fwd)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group