Re: adding years to a date field

From: Michael Glaesemann <grzm(at)seespotcode(dot)net>
To: Christine Penner <chris(at)fp2(dot)ca>
Cc: Postgres-General <pgsql-general(at)postgresql(dot)org>
Subject: Re: adding years to a date field
Date: 2011-04-06 16:27:51
Message-ID: 6F852C30-7A85-4AF4-8BA3-A9596BCCB89F@seespotcode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Apr 6, 2011, at 12:18, Christine Penner wrote:

> This still gave me a sytax error. The other suggestion to multiply the interval field by 1 year also gave me a syntax error.

What was the error? And it's preferable to do multiply rather than do the equivalent of an eval on some string.

select (current_timestamp at time zone 'utc' + CAST(3 AS SMALLINT) * interval '1 year');
?column?
----------------------------
2014-04-06 16:27:30.273562
(1 row)

Michael Glaesemann
grzm seespotcode net

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Christine Penner 2011-04-06 16:36:45 Re: adding years to a date field
Previous Message Christine Penner 2011-04-06 16:18:15 Re: adding years to a date field