DATEADD function | SQL Tutorial and Query Example

Text copied!

DATEADD function


  • The syntax of the DATEADD function generally looks like this :
    Here's an example of how you might use the DATEADD function :

    1. Let's assume we have a table named "[Employees]".

    DATEADD(datepart, number, date )
    Remember :

    Using this function in a select statement won't modify the [Employees] table directly, but it will only be reflected in the select statement's output.

    To enhance your understanding of 'SQL functions', be sure to check out our next tutorial.
    DATEADD function
    SELECT *, DATEADD(YEAR, 10, Joining_Date) AS Revised_Joining_Date
    FROM [Employees];
            
    DATEADD function

    Frequently Asked Questions :

    The Dateadd function in SQL adds a specified time interval to a date.
    To add 30 days to a date in SQL, use the DATEADD function with the appropriate parameters.
    Date_add in SQL is similar to DATEADD; it adds a specified time interval to a date.
    To add 7 days to a date in SQL, use the DATEADD function with the interval set to 'day' and the number of days as the value.