Sql Query to get Two digit Month Number

by Mohan 2014-06-18 15:13:24

Sql Query to get Two digit Month Number


In general ,
SELECT MONTH( CURDATE( ) ) 

returns month number in one digit  for months upto september.
To get two digit number, you can use the following sql query
 
select RIGHT( CAST( 100 + MONTH( CURDATE( ) ) AS CHAR( 3 ) ) , 2 ) as monthnum


it will return two digit month number.


 

Tagged in:

1120
like
0
dislike
0
mail
flag

You must LOGIN to add comments