Beginner

271. DAY Function

Learn how to extract the day of the month from a date.

📘 Lesson 271 of 728 ⏱ 8 min 🎯 Beginner

The DAY function returns the day-of-month component from a date value, typically as a number from 1 through 31.

Extracting the day component is useful when analyzing daily patterns, payment schedules, transaction activity, and operational events.

Find the day of the month on which each order was placed.

SQL
SELECT
    OrderID,
    OrderDate,
    DAY(OrderDate) AS OrderDay
FROM Orders;

DAY is useful in transaction analysis, billing cycles, daily sales reporting, and date-based filtering.

  • DAY extracts the day of the month.
  • The result is normally between 1 and 31.
  • It can be used for filtering and grouping.
  • It is useful for daily analysis.
  • Syntax varies between database systems.
What does DAY return?

DAY returns the day-of-month component from a date.

How can DAY help in analysis?

DAY can help identify daily transaction patterns and create day-based filters or reports.

Have you finished this lesson?

Introduction to SQL – All Lessons