Re: casting for dates

From: Andrew McMillan <andrew(at)catalyst(dot)net(dot)nz>
To: Vince Vielhaber <vev(at)michvhf(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: casting for dates
Date: 2001-09-26 20:57:19
Message-ID: 1001537839.2178.2.camel@kant.mcmillan.net.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 2001-09-27 at 08:30, Vince Vielhaber wrote:
>
> I'm trying to use an integer from a table to add/subtract time in months.
> IOW:
>
> create table foo(nummonths int);
>
> select now() - nummonths months;

newsroom=# select now() - interval( text(3) || ' months');
?column?
------------------------
2001-06-27 08:56:27+12
(1 row)

Crude, but hey: it works :-)

Cheers,
SAndrew.
--
--------------------------------------------------------------------
Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St, Wellington
WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St
DDI: +64(4)916-7217 MOB: +64(21)635-694 OFFICE: +64(4)499-2267

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ryan Mahoney 2001-09-26 21:14:19 Re: casting for dates
Previous Message Neil Padgett 2001-09-26 20:53:08 Re: Spinlock performance improvement proposal