How to Get the Current Date and Time in MySQL

Last updated July 24, 2026 · By the SaturnSQL team

NOW() returns the current datetime, CURDATE() the date, and CURRENT_TIMESTAMP is standard-SQL spelling for NOW(). Use DATE_SUB/DATE_ADD and DATE_FORMAT for offsets and formatting.

SELECT NOW(), CURDATE(), CURRENT_TIMESTAMP;

Yesterday, last 30 days

SELECT
  DATE_SUB(CURDATE(), INTERVAL 1 DAY) AS yesterday,
  DATE_SUB(CURDATE(), INTERVAL 30 DAY) AS thirty_days_ago;

Run this in SaturnSQL

SaturnSQL is a browser-based SQL editor for teams: shared query library, schema-aware autocomplete, and scheduled exports to Google Sheets and Slack.

Try it free

Related MySQL guides

© 2026 Panda Capital Oy Ab. All rights reserved.