Incrementing a date type.
I have an event that is three days long. In a table I want to be able to
enter Friday date and have Saturdays and Sundays fill in automatically. It
also has to check for the month/# of days in...
Example
input : Friday=6-1-2001
autoadd: Saturday=6-2-2001
autoadd: Sunday=6-3-2001
Example 2
input: Friday=June 29
autoadd: Saturday=June 30
autoadd Sunday=July 1
If this can not be done easily (as I'm no expert) please advise.
The reason I would like to do this automatically is to eliminate errors.
On Fri, May 18, 2001 at 12:17:47PM -0500,
DC <danc@bspmail.com> wrote:
I have an event that is three days long. In a table I want to be able to
enter Friday date and have Saturdays and Sundays fill in automatically. It
also has to check for the month/# of days in...
You can add intervals to timestamps. If you use an interval of 1 day, this will
probably do what you want.
Except for Oct 28th if you live in a timezone that does daylight savings.
Ian A. Harding
Programmer/Analyst II
Tacoma-Pierce County Health Department
(253) 798-3549
mailto: ianh@tpchd.org
Bruno Wolff III <bruno@wolff.to> 05/23/01 06:59AM >>>
On Fri, May 18, 2001 at 12:17:47PM -0500,
DC <danc@bspmail.com> wrote:
I have an event that is three days long. In a table I want to be able to
enter Friday date and have Saturdays and Sundays fill in automatically. It
also has to check for the month/# of days in...
You can add intervals to timestamps. If you use an interval of 1 day, this will
probably do what you want.
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly
Import Notes
Resolved by subject fallback
On Wed, May 23, 2001 at 08:51:16AM -0700, Ian Harding wrote:
Except for Oct 28th if you live in a timezone that does daylight savings.
What I do is add 18 hours and the cast to date, truncating it back. Then
dailylight saving has no effect.
Bruno Wolff III <bruno@wolff.to> 05/23/01 06:59AM >>>
On Fri, May 18, 2001 at 12:17:47PM -0500,
DC <danc@bspmail.com> wrote:I have an event that is three days long. In a table I want to be able to
enter Friday date and have Saturdays and Sundays fill in automatically. It
also has to check for the month/# of days in...You can add intervals to timestamps. If you use an interval of 1 day, this will
probably do what you want.
--
Martijn van Oosterhout <kleptog@svana.org>
http://svana.org/kleptog/
On Wed, May 23, 2001 at 08:59:00AM -0500, Bruno Wolff III wrote:
On Fri, May 18, 2001 at 12:17:47PM -0500,
DC <danc@bspmail.com> wrote:I have an event that is three days long. In a table I want to be able to
enter Friday date and have Saturdays and Sundays fill in automatically. It
also has to check for the month/# of days in...You can add intervals to timestamps. If you use an interval of 1 day, this will
probably do what you want.
for example --
select 'april 19, 2001'::date + interval('2 week');
or, just for confusion,
select date('april 19, 2001') + '2 week'::interval;
check the docs on what keywords are acceptable intervals. it's
wonderful.
--
#95: We are waking up and linking to each other. We are watching. But
we are not waiting. -- www.cluetrain.com
will@serensoft.com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!