Total Pageviews

2020/09/09

[Oracle] [Function] LAST_DAY

If today is 2020/09/05, you can using the following SQL statement to get the end day of this month:
SELECT to_char(last_day(to_date('20200905', 'YYYYMMDD')), 'YYYYMMDD') as last_day
FROM DUAL
;
 

If I would like to get the days left from 2020/09/05 in this month:
SELECT (last_day(to_date('20200905', 'YYYYMMDD')) - to_date('20200905', 'YYYYMMDD')) as Days_Left
FROM DUAL
;



Reference

No comments: