Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Taking floor of date

Re: Taking floor of date

From: James Lorenzen <james_lorenzen_at_allianzlife.com>
Date: Thu, 13 May 1999 14:58:45 GMT
Message-ID: <7hepb4$amr$1@nnrp1.deja.com>


Roy, TRUNC(sysdate) will do what you desire. This is a default behavior, you can place (a limited set) a format to control where the date is truncated.

HTH
    James

In article <roy-1305990957090001_at_qwerky.med.nyu.edu>,   roy_at_popmail.med.nyu.edu (Roy Smith) wrote:
> I've got a table with a DATE datatype column in it. I want to select
all
> the rows which contain dates which are the same calendar day as
another
> date I've got. What's the best way to do that?
>
> One way I can see to do that would be to take the integer part of my
> selection date, which would give me time 00:00:00 of that date, then
add 1
> to it, giving me 00:00:00 of the next date, then doing:
>
> select * from table where date >= midnight_today and date <
midnight_tomorrow
>
> but I don't see any way to do the "take the integer part" bit.
>
> The only way I can see to do this is to use the to_char function,
> converting just the year, month, and day-of-month, then use to_date to
> convert that back to a DATE datatype, but that's pretty gross.
>
> --
> Roy Smith <roy_at_popmail.med.nyu.edu>
> New York University School of Medicine
>
>

--== Sent via Deja.com http://www.deja.com/ ==-- ---Share what you know. Learn what you don't.--- Received on Thu May 13 1999 - 09:58:45 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US