Beginner

265. GETDATE Function

Learn how SQL Server retrieves the current date and time using GETDATE.

📘 Lesson 265 of 728 ⏱ 8 min 🎯 Beginner

GETDATE is a SQL Server function that returns the current database server date and time.

SQL Server users frequently need the current timestamp for reporting, auditing, filtering, and calculations.

Retrieve the current SQL Server date and time.

SQL
SELECT
    GETDATE() AS CurrentDateTime;

GETDATE is commonly used in SQL Server audit fields, reports, transaction monitoring, and date calculations.

  • GETDATE is commonly used in SQL Server.
  • It returns the current date and time.
  • It can be used in date calculations.
  • It is database-specific.
  • Time zone and server settings can affect the result.
What does GETDATE do?

GETDATE returns the current date and time from the SQL Server environment.

Is GETDATE standard SQL?

GETDATE is a SQL Server-specific function rather than a universal SQL standard function.

Have you finished this lesson?

Introduction to SQL – All Lessons