Copy code The code is as follows:
// Format date
static function formatDate($format, $datetime, $week = 0) {
$datetime = $datetime > 3000 ? $datetime : strtotime($datetime);
if ($week) {
$weeknames = [
‘Day’,
'One',
'Two',
'Three',
'Four',
'Five',
'Liu'
format = str_replace('w', $weeknames [date('w', $datetime)], $format);
}
return date($format, $datetime);
}
Copy code The code is as follows:
echo "week" . formatDate("w","2012-11-03 00 :46:22" , 1) . " " . formatDate("Y-m-d", "2012-11-03 00:46:22");
echo "week" . formatDate("w","1388678400" , 1) . " " . formatDate("Y-m-d", "1388678400");
Saturday 2012-11-03
Friday 2014-01-03
http://www.bkjia.com/PHPjc/825268.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/825268.htmlTechArticleCopy the code as follows: // Format date static function formatDate($format, $datetime, $week = 0 ) { $datetime = $datetime 3000 ? $datetime : strtotime($datetime); if ($week)...