简体   繁体   中英

How is convert month number to month short name?

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

Based on your code:

$month = 2; 
echo date('M', strtotime('2012-' . $month . '-01'));

strtotime() accepts date not just month

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM