sql - How to get number of days for next month? -
given date, how number of days in next month? so, if original date in december should give 31(january), in january 28/29 (february), etc.
you want number of days in next month? use add_months()
that. use last_day()
establish last day of month. extract()
day give number of days.
today in april, how many days in may?
sql> select sysdate 2 , extract(day (last_day(add_months(sysdate, 1)))) days_next_month 3 dual 4 / sysdate days_next_month --------- --------------- 19-apr-16 31 sql>
oracle has wealth of date functions. can chain them achieve virtually calendrical calculation our heart desires. find out more.
Comments
Post a Comment