Total Pageviews

2016/02/07

[Oracle] How to get the date of the last day of the month in Oracle

Problem
If I would like to get the date of the last day of the month, how to do it?

How to
Oracle had build-in function, LAST_DAY, to fulfill this requirement.

Here is the example:
SELECT to_char(sysdate, 'YYYYMMDD') today,
       to_char(LAST_DAY(sysdate), 'YYYYMMDD') last_day_of_month
FROM dual

Query result :


Reference
[1] https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions077.htm

No comments: