Here are some more Oracle SQL variations using LAST_DAY
for different use cases:
1. Get Last Day of Any Given Year & Month
✅ This will return 30-JUN-2024
.
2. Find Last Day of Previous, Current, and Next Month
✅ Dynamically fetches last days for previous, current, and next month.
3. Get Last Day of Financial Year (March 31st)
✅ If today is in 2024, this will return 31-MAR-2024.
4. Get Last Day of Calendar Year (December 31st)
✅ Returns 31-DEC-2024 if run in 2024.
5. Find the Number of Days in a Given Month
✅ This calculates the number of days in the current month.
6. Get the Last Weekday of the Month
✅ This finds the last weekday (Friday) of the current month.
7. Find the Last Sunday of the Month
✅ Adjust "SUNDAY"
to any day you want.
Here are more advanced Oracle SQL queries using LAST_DAY
for different scenarios:
Tags:
Oracle