Beginner

217. Current Timestamp

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

📘 Lesson 217 of 728 ⏱ 8 min 🎯 Beginner

A current timestamp expression returns the current date and time. The exact function or expression varies between database systems.

Date and time together are important when analyzing events, transactions, system activity, and operational processes.

Display the current date and time.

SQL
SELECT
    CURRENT_TIMESTAMP AS CurrentDateTime;

Timestamps are commonly used for transaction tracking, audit records, system logs, event analysis, and monitoring.

  • A timestamp contains date and time information.
  • CURRENT_TIMESTAMP is widely supported.
  • Syntax can vary between databases.
  • Timestamps are useful for event analysis.
  • Time-zone behavior depends on the database system.
What is a timestamp?

A timestamp represents date and time information associated with an event or value.

Why are timestamps important?

They allow systems and analysts to track when events, transactions, or records occurred.

Have you finished this lesson?

Introduction to SQL – All Lessons