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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Date conversion in plsql YYYYMM

Re: Date conversion in plsql YYYYMM

From: liglin <liglinlillibli_at_hotmail.com>
Date: 25 Mar 2004 22:24:50 -0800
Message-ID: <db9bdb31.0403252224.28790926@posting.google.com>


Thanks Michel,

In the meanwhile I found still another solution:

TO_DATE(TR.TR_BEG_DATE, 'YYYYMM01' converts a date into a date that begins with the first day of the month. Unfortunately, this presumes that the given date is 8 digits long. It won't work if the day is missing and the date consists of only 6 digits.

Thanks,

             Liglin.

"Michel Cadot" <micadot{at}altern{dot}org> wrote in message news:<406282c3$0$11605$636a15ce_at_news.free.fr>...
> "liglin" <liglinlillibli_at_hotmail.com> a écrit dans le message de
> news:db9bdb31.0403242235.f75a976_at_posting.google.com...
> > Hello,
> >
> > I would like to convert a date from YYYYMMDD To YYYYMM01.
> >
> > Is there a simpler way than:
> > TO_DATE(TO_CHAR(TO_DATE(TR.TR_BEG_DATE, 'YYYYMM'),'YYYYMM')|| '01', 'YYYYMMDD');
> >
> > Thanks,
> > Liglin
>
> trunc(TR.TR_BEG_DATE,'MONTH')
>
> Regards
> Michel Cadot
Received on Fri Mar 26 2004 - 00:24:50 CST

Original text of this message

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