Home Sql Sqldate Mysql Date Previous Month



Mysql Date Previous Month
Posted on: June 15, 2009 at 12:00 AM
Mysql Date Previous Month is used to return the current and previous value of the month.

Mysql Date Previous Month

     

Mysql Date Previous Month is used to return the current and previous value of the month.

Understand with Example

The Tutorial illustrate an example that help you to describe Previous Month value. To understand this, we have a month (now( )) that return you current month value.

Query for finding current month:-

 

 

 

mysql> select month(now()) as CurrentMonth;

Output:-

+--------------+
| CurrentMonth |
+--------------+
|           12 |
+--------------+
1 row in set (0.00 sec)

Query for finding Previous month:-

Once you are able to find the current month, you can easily find the previous month before the current month. The Query month(now( )) -1 return you the previous month value precede the current month.

month(now( ))-1 : The month(now( )) -1 return you the previous month  before the current month.

mysql> select month(now())-1 as PreviousMonth;

Output:-

+---------------+
| PreviousMonth |
+---------------+
|            11 |
+---------------+
1 row in set (0.00 sec)

Related Tags for Mysql Date Previous Month:
ciohelpvitutorialvalueriaexampletoexameilmonthdesmnttresratedescribetorxaxampsathallmplprestrvatutorscrssrithstaluhatpleplprono


More Tutorials from this section

Ask Questions?    Discuss: Mysql Date Previous Month  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.