SQL Server Add Time To Date

Most of the time, I was required to add the time to the date, being a senior SQL Server resource. In this comprehensive article, I’ll walk you through multiple approaches on how to add time to a date in SQL Server.

SQL Server Add Time To Date

Before diving into specific approaches, it’s important to understand how SQL Server handles date and time data. SQL Server offers several date and time data types and functions that enable precise temporal calculations.

The most commonly used date/time data types include:

  • DATE: Stores date only (no time component)
  • TIME: Stores time only (no date component)
  • DATETIME: Stores both date and time (accuracy to 3.33 milliseconds)
  • DATETIME2: Improved version of DATETIME (higher precision and larger date range)
  • DATETIMEOFFSET: Includes time zone

Let’s discuss each approach individually to add time to a date in SQL Server.

Approach 1: Using the DATEADD Function

The DATEADD function is the most versatile and widely used method for adding time to a date in SQL Server. It allows you to add a specified time interval to a date value.

Syntax:

DATEADD(datepart, number, date)

Where:

  • datepart: The part of the date to which you want to add (year, quarter, month, day, hour, minute, second, etc.)
  • number: The amount to add (can be positive or negative)
  • date: The date value to modify

Example-1

We can execute the following query to add 3 hours to the current date and time.

SELECT DATEADD(HOUR, 3, GETDATE()) AS 'Current Time Plus 3 Hours';

After executing the above query, I got the expected output as shown in the screenshot below.

SQL Server Add Time To Date

Example-2

We can execute the following query to add 30 minutes to a specific datetime.

SELECT DATEADD(MINUTE, 30, '2025-05-28 14:00:00') AS 'Call End Time';

After executing the above query, I obtained the expected output, as shown in the screenshot below.

SQL Add Time To Date

Example-3

We can execute the following query to add 2 days to the current date.

SELECT DATEADD(DAY, 3, GETDATE()) AS 'Three Days From Now';

After executing the above query, I got the expected output as shown in the screenshot below.

how to add time to a date in SQL Server

Example 4

One of the most common scenarios I encounter is needing to add multiple time units simultaneously, for example, adding 2 hours and 40 minutes to a meeting start time.

We can execute the following query for that purpose.

DECLARE @MeetingStart DATETIME = '2025-05-28 09:00:00';

-- Add 2 hours and 40 minutes to meeting start
SELECT DATEADD(MINUTE, 40, DATEADD(HOUR, 2, @MeetingStart)) AS 'Meeting End';

After executing the above query, I got the expected output as shown in the screenshot below.

how to add time to date in SQL Server

Approach 2: Using Arithmetic Operators

SQL Server also allows for simple arithmetic with DATETIME values.

Example 1

We can execute the following query to add 5 days to the current date.

SELECT GETDATE() + 5 AS 'Five Days From Now';

After executing the above query, I got the expected output as shown in the screenshot below.

How to add time to DateTime in SQL

Example 2

After executing the below query to add 5 days to the current date.

-- Add 5 days to current date
SELECT GETDATE() + 5 AS 'Five Days From Now';

See the expected output below after executing the above query.

How to add time to DateTime in SQL

Example 3

We can execute the following query to add 12 hours to the current date.

SELECT GETDATE() + (12.0 / 24) AS 'Twelve Hours From Now';

After executing the above query, I got the expected output as shown in the screenshot below.

sql server add current time to date

Example 4

We can use the following query to add 45 minutes to the current date.

SELECT GETDATE() + (45.0 / (24 * 60)) AS '45 Minutes From Now';

After executing the above query, I got the expected output as shown in the screenshot below.

sql add current time to date

Example 5

We can execute the following query to add 30 seconds to the current date.

SELECT GETDATE() + (30.0 / (24 * 60 * 60)) AS '30 Seconds From Now';

I obtained the expected output after executing the above query, as shown in the screenshot below.

sql datetime add hours and minutes

Approach 3: Combining DATEADD with Other Date Functions

The DATEADD function works particularly well with other SQL Server date functions.

Example

Let’s say you want to add 2 hours to the start of the current day. We can execute the following query for that purpose.

DECLARE @StartOfDay DATETIME = CAST(CAST(GETDATE() AS DATE) AS DATETIME);
SELECT DATEADD(HOUR, 2, @StartOfDay) AS 'Two Hours After Midnight';

After executing the above query, I got the expected output as shown in the screenshot below.

sql add days to date without dateadd

Comparison of Different Methods

Here’s a quick comparison of the different methods we’ve discussed:

MethodProsConsBest For
DATEADDMost readable, supports all time intervalsSlightly more verboseMost scenarios, especially complex operations
ArithmeticConcise for adding daysLess intuitive for hours/minutes/secondsSimple day additions
Custom FunctionsCan implement business logicMore complex to maintainSpecial requirements like business days

Conclusion

Adding time to dates in SQL Server is essential while working with SQL Server. While the DATEADD function provides the most flexible approach for most cases, knowing all the available approaches gives you the flexibility to choose the right approach for your specific needs.