Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Date conversion in plsql YYYYMM
"liglin" <liglinlillibli_at_hotmail.com> wrote in message
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
Liglin,
Try SELECT TRUNC( tr.tr_beg_date, 'MONTH' ) FROM dual;
Thanks to Sybrand Bakker on an earlier post for the hint (see "select to_date('2004','YYYY') NOT Jan 1 2004").
Douglas Hawthorne Received on Thu Mar 25 2004 - 01:02:42 CST
![]() |
![]() |