Re: More time manipulation.. - Mailing list pgsql-general

From Gregory Seidman
Subject Re: More time manipulation..
Date
Msg-id 20021118191931.GA11410@cs.brown.edu
Whole thread Raw
In response to More time manipulation..  ("Williams, Travis L, NPONS" <tlw@att.com>)
Responses Re: More time manipulation..
List pgsql-general
Williams, Travis L, NPONS sez:
} If I do "select Current_Date".. I get something like:
} 2002-11-25
} if I do "select Current_Date + interval '7 days'; I get:
} 2002-11-25 00:00:00-06
} is there any way to get it to only return the parts I'm passing it
} (all I want is the date).. I know I can do date_part and pull out the
} individual parts and put it back together.. but it looks like I'm
} missing something..

The short answer is to use date_part and like it.

The longer answer is that the addition (+) operator is not defined on a
date and an interval, but since it is defined on a timestamp and an
interval, and a date is castable to a timestamp, PostgreSQL helpfully
casts the date to a timestamp, performs the addition, and returns a
timestamp. What you are getting back is a timestamp because it's the
result of adding an interval to a timestamp.

} Thanks,
} Travis
--Greg


pgsql-general by date:

Previous
From: Frank Bax
Date:
Subject: Re: More time manipulation..
Next
From: "Johnson, Shaunn"
Date:
Subject: performance enhancements for PostgreSQL