Logic to subtract months from a date field and extract run_yr_mo


/ Published in: SQL
Save to your folder(s)

Logic to subtract months from a date field and extract year and month


Copy this code and paste it in your HTML
  1. SELECT TO_CHAR(ADD_MONTHS(TO_DATE(TRIM('02/09/2010'),'MM/DD/YYYY'),-3),'YYYYMM')
  2. FROM dual;
  3.  
  4. RESULT : 200911

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.