CURDATE() – Get Today’s Date in SQL

🔧 Quick Syntax

SELECT CURDATE();

This tells SQL:

“Just give me today’s date. No need for the time part.”

It returns a date like this: YYYY-MM-DD


🧾 Suppose You Want to Add a “Created On” Date (No Time)

INSERT INTO posts (title, created_on)
VALUES ('My First Post', CURDATE());

This inserts today’s date into the created_on column — no hours, minutes, or seconds.


✅ Suppose You Want to See Today’s Date

SELECT CURDATE() AS today;

💡 Output:

2025-04-14

This updates based on your server’s clock — always the current calendar date.


✅ Suppose You Want to Get All Rows Created Today

Let’s say your posts table has a created_on column that stores only the date:

SELECT *
FROM posts
WHERE created_on = CURDATE();

This will pull all posts created today — perfect for dashboards, notifications, or reports.


🧃 Recap – What You Learned

  • CURDATE() gives you today’s date (no time)
  • Format: YYYY-MM-DD
  • Ideal when you don’t need the full timestamp
  • Works great for filtering, logging, and inserting current dates
  • Use with WHERE for daily tracking and clean reports

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top