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()).
💻 Live Code Editor
Is page ki language (MYSQL) mein code likhein aur turant chalाएं — yahीं, bina kuch install kiye.Powered by OneCompiler. Agar editor na khule to yahान naye tab mein kholein.
💻 Live Code Editor
Is page ke program yahan ready hain — chalाएं, badlें aur seekhें. Bina kuch install kiye.
Powered by OneCompiler. Editor mein code apne aap aa jata hai — Run dabaakर output dekhें.
Agar load na ho to naye tab mein kholें.