0
例如我的月號是(3
= 3月)或(2
= 2月),我試了下面的代碼,但它不起作用。如何解決它?如何將月份數字轉換爲月份短名稱?
$month = 2;
echo date('M', strtotime($month));
演示:http://codepad.viper-7.com/ZKctjg
例如我的月號是(3
= 3月)或(2
= 2月),我試了下面的代碼,但它不起作用。如何解決它?如何將月份數字轉換爲月份短名稱?
$month = 2;
echo date('M', strtotime($month));
演示:http://codepad.viper-7.com/ZKctjg
基於您的代碼:
$month = 2;
echo date('M', strtotime('2012-' . $month . '-01'));
strtotime()
接受日期不只是一個月
這已經問:) HTTP: //stackoverflow.com/quest離子/ 2943292 /轉換月份與月份之間的短名稱 和這裏 http://stackoverflow.com/questions/4612012/php-convert-month-number-to-short-month-name – user690936 2012-01-01 07:26:26
這已經問 http://stackoverflow.com/questions/2943292/convert-month-number-to-month-short-name – user690936 2012-01-01 07:26:48
這已經問 的http://計算器.com/questions/2943292/convert-month-number-to-month-short-name http://stackoverflow.com/questions/4612012/php-conv月份 - 月 - 月 - 短名稱 – user690936 2012-01-01 07:27:54