Posted in PHP onFebruary 24, 2014
// 格式化日期 static function formatDate($format, $datetime, $week = 0) { $datetime = $datetime > 3000 ? $datetime : strtotime($datetime); if ($week) { $weeknames = [ '日', '一', '二', '三', '四', '五', '六' ]; $format = str_replace('w', $weeknames [date('w', $datetime)], $format); } return date($format, $datetime); }
echo "周" . formatDate("w","2012-11-03 00:46:22" , 1) . " " . formatDate("Y-m-d", "2012-11-03 00:46:22"); echo "周" . formatDate("w","1388678400" , 1) . " " . formatDate("Y-m-d", "1388678400"); 周六 2012-11-03 周五 2014-01-03
php格式化日期和时间格式化示例分享
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@