Sql Date Functions — Free Sql Tutorial

Learn Sql Date Functions in Sql with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.

Sql Date Functions — Free Sql Tutorial

Learn Sql Date Functions in Sql with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.

✓ 100% Free ✓ No Login Needed ✓ NCERT / CBSE Aligned ✓ Download as PDF

TL;DR: Learn Sql Date Functions in Sql with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.

Written & reviewed by the Syllab.in Academic Team (CBSE/NCERT subject experts) · Updated

🤖 Stuck on any question? Ask Syllab's free AI Tutor for a step-by-step explanation — instant, unlimited, no login.

Sql Date Functions in Sql

SQL has rich date/time functions: NOW() returns current timestamp, CURDATE() returns today's date, YEAR/MONTH/DAY() extract parts, DATEDIFF() computes difference in days.

DATE_ADD(date, INTERVAL n unit) adds time: DATE_ADD(NOW(), INTERVAL 7 DAY) = one week from now. DATE_SUB subtracts.

DATE_FORMAT(date, format) formats dates: DATE_FORMAT(order_date, "%d %M %Y") → "15 January 2025".

Filtering by date: WHERE order_date >= "2025-01-01" AND order_date < "2026-01-01" selects all 2025 orders. Use BETWEEN for inclusive ranges.

Sql Date Functions — Syntax

SELECT NOW()                        -- current timestamp
SELECT CURDATE()                    -- today's date
SELECT YEAR(date_col)               -- extract year
SELECT DATEDIFF(end_date, start_date)  -- days between
SELECT DATE_ADD(date, INTERVAL 30 DAY)
SELECT DATE_FORMAT(date, '%d %M %Y')  -- "15 January 2025"
SELECT TIMESTAMPDIFF(YEAR, dob, NOW()) AS age

Learn Sql Date Functions step by step with Syllab's free interactive Sql tutorial — runnable code examples, practice exercises and instant AI feedback, all free with no signup. Explore the full Sql course →