Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extracting string from sysdate. 1

Status
Not open for further replies.

EdRev

Programmer
Aug 29, 2000
510
US
The format of my sysdate is in 'DD-MON-YY' (i.e 25-MAR-03).
I want to extract the following rom this date string.

strMonth = MAR
intMonth = 03
strYear = 2003
intYear = 3

Can anybody show me the function(s) to do the above including the declaration section.
 
try this (i did not test it, writing it on the fly):

declare

strMonth varchar2(3);
intMonth number;
strYear number;
intYear number;
begin
strMonth := to_char(sysdate, 'MON');
intMonth := to_char(sysdate, 'mm');
strYear := to_char(sysdate, 'yyyy');
intYear := mid(to_char(sysdate, 'yy'), 2, 1);
end;
--
regards,
Simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top