MySQL add month
Posted on: June 2, 2010 at 12:00 AM
In this section we will learn how to add 1 month, 2 months and 12 months to a date with the help of DATE_ADD function in MySQL.

MySQL add month

In this section we will learn how to add 1 month, 2 month and 12 month to a date object in MySQL.

The MySQL DATE_ADD function is used to add certain time interval to the date object. The MySQL DATE_ADD function can be used to add any time values to the date object.

DATE_ADD() function is used to add time values (intervals) to a date valueADS_TO_REPLACE_1

The following table shows the expected form of the expr argument for each unit value.

unit Value Expected expr Format
MICROSECOND MICROSECONDS
SECOND SECONDS
MINUTE MINUTES
HOUR HOURS
DAY DAYS
WEEK WEEKS
MONTH MONTHS
QUARTER QUARTERS
YEAR YEARS
SECOND_MICROSECOND 'SECONDS.MICROSECONDS'
MINUTE_MICROSECOND 'MINUTES:SECONDS.MICROSECONDS'
MINUTE_SECOND 'MINUTES:SECONDS'
HOUR_MICROSECOND 'HOURS:MINUTES:SECONDS.MICROSECONDS'
HOUR_SECOND 'HOURS:MINUTES:SECONDS'
HOUR_MINUTE 'HOURS:MINUTES'
DAY_MICROSECOND 'DAYS HOURS:MINUTES:SECONDS.MICROSECONDS'
DAY_SECOND 'DAYS HOURS:MINUTES:SECONDS'
DAY_MINUTE 'DAYS HOURS:MINUTES'
DAY_HOUR 'DAYS HOURS'
YEAR_MONTH 'YEARS-MONTHS'

So, based on your requirement you can use following parameter with the DATE_ADD function to add required time interval to a date object.

MICROSECOND
SECOND
MINUTE
HOUR
DAY
WEEK
MONTH
QUARTER
YEAR
SECOND_MICROSECOND
MINUTE_MICROSECOND
MINUTE_SECOND
HOUR_MICROSECOND
HOUR_SECOND
HOUR_MINUTE
DAY_MICROSECOND
DAY_SECOND
DAY_MINUTE
DAY_HOUR
YEAR_MONTH

 ADS_TO_REPLACE_2

Following example shows how to add 1 month to a date object:

SELECT DATE_ADD('2008-12-15', INTERVAL 1 MONTH)

Output:ADS_TO_REPLACE_3

2009-01-15

Following example show how to add 2 months:

SELECT DATE_ADD('2010-12-15', INTERVAL 2 MONTH)ADS_TO_REPLACE_4

Output:

2011-02-15

Following example shows how to add 12 months:ADS_TO_REPLACE_5

SELECT DATE_ADD('2010-12-15', INTERVAL 12 MONTH)

Output:

2011-12-15ADS_TO_REPLACE_6

In this section you learned how to add months with the help of DATE_ADD function of MySQL.

More Tutorials on roseindia.net for the topic MySQL add month.
MySQL add month
MySQL add month In this section we will learn how to add 1 month, 2 month and 12 month to a date object in MySQL. The MySQL DATE_ADD function is used to add certain time interval to the date object. The MySQL DATE_ADD function can
 
Mysql Date Month
Mysql Date Month       Mysql Date Month is used to find out the value of current month. Understand with ExampleADS_TO_REPLACE_1 The Tutorial illustrate an example from 'Mysql Date
 
Mysql Date Previous Month
Mysql Date Previous Month       Mysql Date Previous Month is used to return the current and previous value of the month. Understand with ExampleADS_TO_REPLACE_1 The Tutorial
 
Mysql last day of month
Mysql last day of month       Mysql Last Day of Month is useful to provide you the last... illustrate an example from Mysql Last Day of Month. To understand
 
Calculate Month Difference in mysql - SQL
Calculate Month Difference in mysql  hi , i am rahul.Can anybody plz help me.i am calculating month difference in mysql5.0 procedure . i have done... of date increasing or decreasing based on month like 31 and 30 .coding
 
Mysql date month name
Mysql date month name       The Tutorial elaborate an example from Date Month Name in Mysql. To get the current value for the month of the year ,we use the following Query:  
 
Mysql Date Get Month
Mysql Date Get Month       The tutorial explains you the way to retrieve the current month... 'Mysql Date Get Month'. To understand this example, we use Month(Current
 
Mysql last day of month
Mysql last day of month       The Tutorial illustrate an example from 'Mysql Last Day of Month'. To  understand and grasp the example we run LAST_DAY
 
PHP Date add 1 month
PHP Date add 1 month This example shows you how one month can be added... to add 1 month:ADS_TO_REPLACE_1 <?php //PHP Example code to add one... date echo "Today: ".$todayDate."<br>"; //Add one
 
how to find last day 0f any given month in mysql?
how to find last day 0f any given month in mysql?  how to find last day of any given month in mysql?   Hi Friend, Here is required code:ADS_TO_REPLACE_1 DECLARE @dtDate DATETIME SET @dtDate = '8/18/2007' SELECT
 
How to Addding One Month with PHP ?
How to Addding One Month with PHP ?  Hi, I am very new in this php programming language. Can anybody will guide me how to add 1 month on a specific date on PHP. Please give any example or reference links. Please feel free
 
mysql alter table add column
mysql alter table add column  Hi, What is the syntax of mysql alter table add column? Thanks   Hi, Here is mysql alter table add column example: ALTER TABLE employee ADD address VARCHAR(50); Read more at MySQL Add
 
Mysql Date Add
Mysql Date Add       Mysql Date Add is used to add the days  to the date specified... an example from 'Mysql Date Add'. To grasp this example we use query AddDate
 
Mysql Date Name
Mysql Date Name       Mysql Date Name helps you to find out the current Date of the Month... you  in find out the current date of the month. date_format(now( ),'%e
 
Mysql Date Add Year
Mysql Date Add Year       Mysql Date Add Year explains to add the year to the particular... an example from 'Mysql Date Add Year'. To graspe this example, we use Add
 
php mysql
php mysql  automatically insert a value in the month field at the last date of current month in mysql database
 
php mysql
php mysql  automatically insert a value in the month field at the last date of current month in mysql database
 
Mysql Add Column Number
Mysql Add Column Number       Mysql Add Column Number is used to add the column to the existing table... 'Mysql Add Column Number'.To understand and grasp this example we create
 
MySQL Front
MySQL Front       In this page you will find many tools that you can use as MySQL Front to work with the MySQL Database. These MySQL Front tools actually helps you in working fast and easily
 
Mysql Alter Add Column
Mysql Alter Add Column       Mysql Alter Add Column is used to define the existing Table..._TO_REPLACE_1 The Tutorial demonstrate you 'Mysql Alter Add Column'. To understand
 
Mysql add primary key
Mysql add primary key       Mysql add Primary Key is used to add primary key on the column... of this tutorial illustrate an example from 'Mysql Add Primary Key'. To understand
 
MySQL Add Column
MySQL Add Column       MySQL Add Column tutorial explains you to add the column to the existing.... Understand with ExampleADS_TO_REPLACE_1 The Tutorial describes Add Column in MySQL
 
mysql alter table add unique constraint
mysql alter table add unique constraint  How to add mysql alter table add unique constraint in mysql table. Thanks   Hi Following query query can be used: ALTER TABLE mytable ADD CONSTRAINT uc_key1 UNIQUE
 
alter table add foreign key mysql
alter table add foreign key mysql  Hi, How to add foreign key in mysql using the query 'alter table add foreign key mysql' Thanks   Hi, We can use the following query: ALTER TABLE emp_address ADD FOREIGN KEY (emp_id
 
MySQL Add Column
MySQL Add Column       MySQL Add Column is used to add the column to the existing table. The Alter table... The Tutorial describe Add Column in MySQL. To understand the example we use select
 
MySQL Add Column
MySQL Add Column       MySQL Add Column is used to add the column to the existing table..._TO_REPLACE_1 The Tutorial describe Add Column in MySQL. To understand
 
mysql alter table add multiple columns
mysql alter table add multiple columns  Hi, I have a table... for mysql alter table add multiple columns? Thanks   Hi, You can use...), -> add column email varchar(30); Read more at Mysql Alter Add
 
Mysql Date Query
Mysql Date Query       Mysql Date Query Date Query is used to return the current date, month and year... an example from 'Mysql Date Query'. To understand this example we use current
 
Mysql Date Functions
Mysql Date Functions       Mysql Date Functions return you the  current date, current year and current month. Understand with ExampleADS_TO_REPLACE_1 The Tutorial
 
Mysql Alter Add Multiple Columns
Mysql Alter Add Multiple Columns       Mysql Alter Add Multiple Columns is used to modify... with ExampleADS_TO_REPLACE_1 The Tutorial illustrate an example from 'Mysql Alter Add
 
Mysql Date Add Days
Mysql Date Add Days       The Tutorial illustrate an example to add days to the particular... you the way to add days to the particular date. SYNTAX:- ADDDATE(date,INTERVAL
 
jsp page to add users to mysql database
jsp page to add users to mysql database  <%@taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <%@taglib uri="/WEB-INF/struts-bean.tld...-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Add
 
jsp page to add the user to mysql database
jsp page to add the user to mysql database  adduser.jsp: <%@taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <%@taglib uri="/WEB-INF...;title>Add User</title> </head> <form name="user" action
 
Mysql Add Column Default Value
Mysql Add Column Default Value       Mysql Add Column Default Value is used to add the default value..._TO_REPLACE_1 The Tutorial illustrate an example from 'Mysql Add Column Default
 
While creating a jar how to add MySQL database to project
While creating a jar how to add MySQL database to project  Hi, Please tell me how to attach MySQL database to the Java project while building a jar or their is any other process
 
ModuleNotFoundError: No module named 'month'
ModuleNotFoundError: No module named 'month'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'month' How to remove the ModuleNotFoundError: No module named 'month'
 
to renew leave to next month
an employee must be able to apply leave only once in a month, and if he doesn't use that leave in that particular month, it must be renewed to the next month so that he can apply leave for 2 days the next month
 
Add values of drop down menu( select option) to mysql table
Add values of drop down menu( select option) to mysql table   Here..."; echo $change; } */ $query_auto="UPDATE valve set position='".mysql_real_escape_string($change)."' where valveName='$select1'"; mysql_query
 
MySql,java
MySql,java  In MySQL table i am adding the fields of name,photo,video,age,category.in the category i have some subjects.if one person login into my... if admin add the one more subject under the category field in the web site page
 
mysql query
mysql query  how do transfer into the excel data to my sql  ...; data sources. 2)Click Add button and select the Drive do Microsoft Excel(*.xls... the mysql connection in your php and store the list values inside the mysql
 
jsp mysql
jsp mysql  actually i want a page that has two frames nd in 1 frame i'l add a textarea to post some help nd nw when he clicks on post button it has.............. like that all requests nd comments should be display through jsp and mysql
 
How to add
How to add   Hi, I want to make a website which will recommend users books according to the genre selected by them. I am using PHP, JavaScript and mySQL. The problem is that there will me almost more than 100 books
 
MySQL LEFT OUTER JOIN
MySQL LEFT OUTER JOIN  Hi There, I need to perform LEFT OUTER JOIN on 2 tables. Trans_type tt Trans t I used the below MySQL query...)='2012' AND MONTH(t.transcrtndt)='1' AND GROUP BY tt.transtypename ORDER
 
SQL Add Column Position
SQL Add Column Position       The Tutorial helps you to understand an example from 'SQL  Add Column Position' in Mysql. To understand and grasp the example we simply create
 
MySql ClassNotFoundException - JDBC
; Hi Friend, Add mysql-connector-java-5.0.5.jar file. Thanks...MySql ClassNotFoundException  Dear sir, i am working in Linux platform with MySQL database , actually i finished all installation in MySQL
 
mysql 8 connector maven
add into pom.xml file of my project. Share me the mysql 8 connector maven...mysql 8 connector maven  Hi, I have installed latest version of MySQL 8.X and now I want to update my Java project to connect to MySQL 8. My Java
 
mysql 8 connector maven
add into pom.xml file of my project. Share me the mysql 8 connector maven...mysql 8 connector maven  Hi, I have installed latest version of MySQL 8.X and now I want to update my Java project to connect to MySQL 8. My Java
 
node dependency mysql package.json
node dependency mysql package.json  Hi, How to add node dependency mysql package.json? Thanks   Hi, You can do this by running following command in your project: npm install mysql --save Thanks
 
node dependency mysql package.json
node dependency mysql package.json  Hi, How to add node dependency mysql package.json? Thanks   Hi, You can do this by running following command in your project: npm install mysql --save Thanks
 
mysql connector 6.0.2 download
mysql connector 6.0.2 download  Hi, Where to download JDBC driver mysql connector 6.0.1? I am using maven in my project. Thanks   Hi, You can use the maven for mysql connector 6.0.2 jar file automatic download. Add
 
Ads

Related Tags for MySQL add month:


Ads

 
Advertisement null

Ads