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.
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
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
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 →