Reputation: 643
For example my month number is (3
= Mar) Or (2
= Feb), i tryed as following code, but it doesn't work. How fix it?
$month = 2;
echo date('M', strtotime($month));
Demo: http://codepad.viper-7.com/ZKctjg
Upvotes: 0
Views: 3780
Reputation: 254886
Based on your code:
$month = 2;
echo date('M', strtotime('2012-' . $month . '-01'));
strtotime()
accepts date not just month
Upvotes: 3