Skip to content

Instantly share code, notes, and snippets.

@jamespaultg
Created September 11, 2018 13:53
Show Gist options
  • Select an option

  • Save jamespaultg/e2eb2388c1904786d2bb205eddd5ab96 to your computer and use it in GitHub Desktop.

Select an option

Save jamespaultg/e2eb2388c1904786d2bb205eddd5ab96 to your computer and use it in GitHub Desktop.
Handy sql scripts to get dates
--Get the last date of the previous year (31-Dec-yyyy)
select trunc(current_date, 'yyyy')-1 from dual;
-- Get the first date of the previous year (01-Jan-yyyy)
select add_months(trunc(current_date, 'yyyy'),-12) from dual;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment