MySQL + SQL · Lesson 1

First Last Day Month

Month Boundaries

MySQL can find the first and last day of the current (or any) month using built-in date functions.

The Queries

-- first day of current month
SELECT DATE_FORMAT(CURDATE(), '%Y-%m-01') AS first_day;

-- last day of current month
SELECT LAST_DAY(CURDATE()) AS last_day;
first_day: 2026-06-01 last_day: 2026-06-30

Summary

  • First day: DATE_FORMAT(CURDATE(), '%Y-%m-01').
  • Last day: LAST_DAY(CURDATE()).
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

\n