Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: oracle question to get Date minus 1
hello Brian,
thanks for your suggestions.
this is what i tried.
SQL> select to_date('20060928', 'YYYYMMDD') - 1 from dual;
TO_DATE('
can you please suggest me how do I get the output as 20060927
thanks a bunch
mark
Brian Peasland wrote:
> pawan_test wrote:
> > can anyone also please suggest me for the following
> >
> > this is oracle question
> >
> > say TIME=20060928
> > desired output: 20060927
> >
> > say TIME=20061001
> > DESIRED output: 20060930
> >
> > If i substract one day from 'TIME' i am looking for previous day.
> >
> > can anyone please suggest me how do i do this is SQL.
> >
> > thanks
> > mark
> >
>
> Just subtract 1 from the date value. For instance, if the date value is
> stored in the column MY_DATE, then do the following:
>
> SELECT my_date-1 FROM my_table;
>
> The above will subtract 1 day from the date value.
>
> HTH,
> Brian
>
> --
> ===================================================================
>
> Brian Peasland
> dba_at_nospam.peasland.net
> http://www.peasland.net
>
> Remove the "nospam." from the email address to email me.
>
>
> "I can give it to you cheap, quick, and good.
> Now pick two out of the three" - Unknown
Received on Thu Sep 28 2006 - 22:18:08 CDT
![]() |
![]() |