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)...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn