Beginner

263. CURRENT_TIMESTAMP

Learn how to retrieve the current date and time as a timestamp.

📘 Lesson 263 of 728 ⏱ 8 min 🎯 Beginner

CURRENT_TIMESTAMP returns the current date and time according to the database session or system context.

A timestamp is useful when both date and time are required to identify when an event occurred.

Capture the current date and time when generating a report.

SQL
SELECT
    CURRENT_TIMESTAMP AS CurrentDateTime;

CURRENT_TIMESTAMP is commonly used for audit information, transaction tracking, logging, and record timestamps.

  • CURRENT_TIMESTAMP returns date and time.
  • It is commonly used for timestamps.
  • It can support audit columns.
  • Time zone behavior depends on the database.
  • It is widely supported in relational databases.
What does CURRENT_TIMESTAMP return?

It returns the current date and time according to the database session or system context.

Where is CURRENT_TIMESTAMP commonly used?

It is commonly used for auditing, logging, transaction tracking, and recording event times.

Have you finished this lesson?

Introduction to SQL – All Lessons