I am trying to output a date in the format DD/MON/YYYY
where the year has 4 digits. My variable return a year with 4 digits (e.g 2000, not 00), but when I run it through the to_date
function it seems to be assigning it as a 2 digit.
I tried to show output to isolate the input I am giving for the year and it is outputting that the year variable is 4 digits so I am not sure what is going wrong.
This is my code:
myDate1 := to_date(myDate1_DD || '/' || myDate1_MON || '/' || myDate1_YY , 'DD/MON/YYYY');
myDate2 := to_date(myDate2_DD || '/' || myDate2_MON || '/' || myDate2_YY , 'DD/MON/YYYY');
IF myDate1 > myDate2
THEN
-- return '01/JAN/01 > 01/JAN/99. The year for date1 is 2001'
return myDate1 || ' > ' || myDate2 || '. The year for date1 is ' || myDate1_YY;
ELSE
-- return '01/JAN/03 > 01/JAN/02. The year for date2 is 2003'
return myDate2 || ' > ' || myDate1 || '. The year for date2 is ' || myDate2_YY;
END IF;
So essentially instead of an output like 01/JAN/03
, I would like an output like 01/JAN/2003
.
Cheers