| From: | Gregory Seidman <gss+pg(at)cs(dot)brown(dot)edu> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: More time manipulation.. |
| Date: | 2002-11-18 19:19:31 |
| Message-ID: | 20021118191931.GA11410@cs.brown.edu |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Johnson, Shaunn | 2002-11-18 19:21:04 | performance enhancements for PostgreSQL |
| Previous Message | Frank Bax | 2002-11-18 19:16:50 | Re: More time manipulation.. |