Beginner

280. LAST_DAY Function

Learn how to find the last calendar day of a month.

📘 Lesson 280 of 728 ⏱ 9 min 🎯 Intermediate

The LAST_DAY function returns the final calendar day of the month containing a specified date in database systems that support the function.

Month-end dates are important for financial reporting, reconciliation, accounting, compliance, and monthly performance analysis.

Find the month-end date for each transaction.

SQL
SELECT
    OrderDate,
    LAST_DAY(OrderDate) AS MonthEndDate
FROM Orders;

LAST_DAY is useful for month-end reporting, financial closing, billing cycles, compliance reporting, and reconciliation.

  • LAST_DAY returns the final day of a month.
  • It automatically handles different month lengths.
  • It handles February and leap years.
  • It is useful for month-end reporting.
  • Function support varies by database.
What does LAST_DAY do?

LAST_DAY returns the final calendar day of the month containing the supplied date.

Why is LAST_DAY useful in finance?

It helps identify month-end dates used for financial closing, reporting, reconciliation, and compliance activities.

Have you finished this lesson?

Introduction to SQL – All Lessons