Php specifies the date to obtain the format of the day of the week, such as 20151225. How can I find the day of the week... Ask for advice.
Reply to discussion (solution)
$ Time = time ();
Echo date ('D', $ time); // The Day of the week, represented in text, with three letters Mon to Sun
Echo date ('L', $ time); // The Day of the week. The Complete Text format is Sunday to Saturday.
Echo date ('N', $ time); // The Day of the week represented by a number in ISO-8601 format (PHP 5.1.0 plus) 1 (Monday) to 7 (Sunday)
Echo date ('W', $ time); // The Day of the week. The number indicates 0 (Sunday) to 6 (Saturday)
Baidu one search engine ....
$ Time = time ();
Echo date ('D', $ time); // The Day of the week, represented in text, with three letters Mon to Sun
Echo date ('L', $ time); // The Day of the week. The Complete Text format is Sunday to Saturday.
Echo date ('N', $ time); // The Day of the week represented by a number in ISO-8601 format (PHP 5.1.0 plus) 1 (Monday) to 7 (Sunday)
Echo date ('W', $ time); // The Day of the week. The number indicates 0 (Sunday) to 6 (Saturday)
Baidu one search engine ....
Brother, you get the current timestamp .... I am asking about the specified date... Format like 20151225 .. 20151225 is not the timestamp .. Eldest brother
Do you know that the date will not be converted into a timestamp?
Do you know that the date will not be converted into a timestamp?
$time = strtotime("2015-12-12");echo date('N', $time);
I thought there were some original functions. The results still have to be done...
Close the post ..
Here, we will first convert a string like 20151225 into an array using the str_split function. Then manually splice them into the required format. The code is as follows. Hope to help people in the future ..
$str = str_split("20151225");$time = $str[0].$str[1].$str[2].$str[3]."-".$str[4].$str[5]."-".$str[6].$str[7];echo date("l",strtotime("$time"));