Hi There, how Do I figure out the YYYY-MM-DD of the last Friday of a Given YYYY-MM, or any similiar datemask query? (first Monday of month, etc...)
Tnx!
Printable View
Hi There, how Do I figure out the YYYY-MM-DD of the last Friday of a Given YYYY-MM, or any similiar datemask query? (first Monday of month, etc...)
Tnx!
Almost like next_day but perhaps last_day ?
create or replace function last_fri (P_yyyydd varchar2) return varchar2 is
v_date date;
begin
select next_day(last_day(to_date(P_yyyydd,'YYYY-MM')) - 7, 'FRIDAY') into v_date from dual;
return (v_date);
end;
/
show errors;