In Oracle, you can use the LAST_DAY
function to find the last day of a given month. Here’s how:
1. Basic Query
✅ This returns the last day of the current month.
2. For a Specific Date
If you want the last day of a specific month, replace SYSDATE
with your desired date:
✅ This will return 29-FEB-2024 (since 2024 is a leap year).
3. Finding the Last Day of a Specific Year and Month
✅ This will return 31-JUL-2024.
4. Using LAST_DAY with TRUNC for Month Start & End
✅ This will return:
- First day of the current month.
- Last day of the current month.
Tags:
Oracle