Re: Adding a date and an interval...

From: "Len Morgan" <len-morgan(at)crcom(dot)net>
To: "Ian Harding" <ianh(at)co(dot)pierce(dot)wa(dot)us>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Adding a date and an interval...
Date: 2001-05-22 02:49:26
Message-ID: 016301c0e269$de97aee0$0908a8c0@H233.bstx.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>select cast('10/28/01' as date) + cast('1 day' as interval);
>
>I get 2001-10-28 23:00:00-08, when I expect 2001-10-29 etc. I am using
this in a loop in a pltcl function.

I believe you can use tcl instead of a select:

return clock format [expr [clock scan '10/28/01'] + 86400] -format
"%Y-%m-%d"

This should be every bit as fast as using a SELECT.

len morgan

Browse pgsql-general by date

  From Date Subject
Next Message GH 2001-05-22 03:56:18 Re: 2GB file size limit
Previous Message John 2001-05-22 02:48:58 perl vs php for postgresql