Tutorial Gateway

  • C
  • C#
  • Java
  • Python
  • SQL
  • MySQL
  • Js
  • BI Tools
    • Informatica
    • Talend
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • R Tutorial
    • Alteryx
    • QlikView
  • More
    • C Programs
    • C++ Programs
    • Python Programs
    • Java Programs
    • SQL FAQ’s

MySQL ADDDATE Function

by suresh

MySQL ADDDATE function is a Synonym of the DATE_ADD Function. This Date Function adds the specified intervals to the given date & time and returns the date or DateTime.

In this section, we show you how to use this MySQL ADDDATE function to add specified intervals to a date expression with an example. The basic syntax of the ADDDATE() Function in MySQL is as shown below:

ADDDATE(Date, INTERVAL expression Unit);

MySQL ADDDATE function Example

The following are the list of examples that help you understand the use of this ADDDATE function.

In this example, First, we are adding 31 days to a given Datetime expression. Next, we added 16 Weeks. Within the third statement, we added 18 Months to that Date.

TIP: I suggest you refer to the Date Function article in MySQL to understand the Units after the Interval. And also refer DATE_ADD Function.

SELECT ADDDATE('2019-02-28 23:59:59', INTERVAL 31 DAY);

SELECT ADDDATE('2019-02-28 23:59:59', INTERVAL 16 WEEK);

SELECT ADDDATE('2019-02-28 23:59:59', INTERVAL 18 MONTH);

OUTPUT

MySQL ADDDATE Function 1

In this MySQL ADDDATE function example, we added 5 Quarters to a given Datetime expression. Next, added 4 Years. In the last Data functions statement, we added 12 Years and 8 Months to the given DateTime value.

SELECT ADDDATE('2019-02-28 23:59:59', INTERVAL 5 QUARTER);

SELECT ADDDATE('2019-02-28 23:59:59', INTERVAL 4 YEAR);

SELECT ADDDATE('2019-02-28 23:59:59', INTERVAL '12-10' YEAR_MONTH);

OUTPUT

MySQL ADDDATE Function 2

Placed Under: MySQL

  • How to Download MySQL
  • Install MySQL on Windows
  • MySQL Create Database
  • MySQL Delete Database
  • MySQL Create Table
  • MySQL Drop Table
  • MySQL SELECT Statement
  • MySQL ALIAS Column
  • MySQL Distinct
  • MySQL Insert Statement
  • MySQL Delete
  • MySQL Truncate Table
  • MySQL WHERE Clause
  • MySQL Order By
  • MySQL Group By
  • MySQL Having Clause
  • MySQL LIMIT
  • MySQL Arithmetic Operators
  • MySQL COALESCE Function
  • MySQL AND Operator
  • MySQL NOT Operator
  • MySQL OR Operator
  • MySQL XOR Operator
  • MySQL BETWEEN Operator
  • MySQL Not Between Operator
  • MySQL GREATEST Function
  • MYSQL LEAST Function
  • MySQL LIKE Operator
  • MySQL NOT LIKE Operator
  • MySQL IFNULL Operator
  • MySQL NULLIF Operator
  • MySQL INTERVAL Operator
  • MySQL IS Operator
  • MySQL IN Operator
  • MySQL NOT IN Operator
  • MySQL IS NOT NULL
  • MySQL IS NULL
  • MySQL Inner Join
  • MySQL Cross Join
  • MySQL Right Join
  • MySQL Left Join
  • MySQL Aggregate Functions
  • MySQL Date Functions
  • MySQL Date Function
  • MySQL String Functions
  • MySQL Numeric Functions
  • C Tutorial
  • C# Tutorial
  • Java Tutorial
  • JavaScript Tutorial
  • Python Tutorial
  • MySQL Tutorial
  • SQL Server Tutorial
  • R Tutorial
  • Power BI Tutorial
  • Tableau Tutorial
  • SSIS Tutorial
  • SSRS Tutorial
  • Informatica Tutorial
  • Talend Tutorial
  • C Programs
  • C++ Programs
  • Java Programs
  • Python Programs
  • MDX Tutorial
  • SSAS Tutorial
  • QlikView Tutorial

Copyright © 2021 | Tutorial Gateway· All Rights Reserved by Suresh

Home | About Us | Contact Us | Privacy Policy