How to Get the Current Date and Time in SQL Server

Last updated August 26, 2026 · By the SaturnSQL team

GETDATE() returns the current local datetime, SYSDATETIME() the same at datetime2 precision, and GETUTCDATE()/SYSUTCDATETIME() the UTC equivalents. CAST to date when you only want the day.

GETDATE() returns datetime, accurate to roughly 3 milliseconds. SYSDATETIME() returns datetime2 at far higher precision and is the better default on modern versions. The two UTC variants return the same instants in UTC, which is what anything compared across regions should use. SYSDATETIMEOFFSET() adds the offset itself.

SELECT GETDATE(), SYSDATETIME(), GETUTCDATE(), SYSUTCDATETIME();

Today's date without the time

Casting to date is the correct way to strip the time; the old CONVERT(varchar, GETDATE(), 112) trick produces a string that sorts as one. When filtering, avoid CAST(created_at AS date) = @today, since wrapping the column makes the predicate non-sargable and blocks the index. Use created_at >= @today AND created_at < DATEADD(day, 1, @today) instead.

SELECT CAST(GETDATE() AS date) AS today;

GETDATE(), SYSDATETIME() and their UTC counterparts

GETDATE() returns a datetime accurate to roughly 3 milliseconds, a rounding that is a real source of off-by-one comparisons at midnight. SYSDATETIME() returns datetime2 with much finer precision and is the better default for new code. Both read the clock of the machine SQL Server runs on, not the client, so a server in another region shifts every timestamp: GETUTCDATE() and SYSUTCDATETIME() are the ones to store.

SELECT GETDATE(), SYSDATETIME(), GETUTCDATE(), SYSUTCDATETIME();

Getting today without the time

Casting to date is the clear way to drop the time, and unlike the old DATEADD/DATEDIFF trick it reads as what it means. For filtering, do not cast the column itself: compare it against a half-open range so the index still applies.

SELECT CAST(GETDATE() AS date) AS today;

SELECT * FROM dbo.orders
WHERE created_at >= CAST(GETDATE() AS date)
  AND created_at <  DATEADD(day, 1, CAST(GETDATE() AS date));

Common errors

Msg 241, Level 16, State 1, Line 1 Conversion failed when converting date and/or time from character string.

A date literal was interpreted with the session language and DATEFORMAT, and the day did not fit the month position. The same statement can work for one login and fail for another, which is what makes it hard to reproduce.

Write date literals in a format SQL Server reads the same way regardless of session settings: 'YYYYMMDD' for dates, and the full ISO 8601 form with a T for datetimes.

SELECT CAST('20260831' AS date);
SELECT CAST('2026-08-31T14:05:00' AS datetime2);

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

Do more with SQL Server

Related SQL Server guides