Php extracts the timestamp of Monday and Sunday. Taking out the timestamp of Monday and Sunday can be seen through the following two examples of taking out the timestamp of Monday and Sunday. we need to keep thinking about it, the first custom fetch specifies the day to retrieve the timestamp of Monday and Sunday.
We can see a lot of things through the following two examples of getting timestamps from Monday and Sunday. we need to keep thinking that it is better to get the timestamp of the specified date first, but how to retrieve the second one on Monday and Sunday is more practical.
*/
Function getmonsun () {$ curtime = time (); $ curweekday = date ('w'); // if it is set to 0, it means Week 7 $ curweekday = $ curweekday? $ Curweekday: 7; $ curmon = $ curtime-($ curweekday-1) * 86400; $ cursun = $ curtime + (7-$ curweekday) * 86400; $ cur ['mon'] = $ curmon; $ cur ['sun'] = $ cursun; return $ cur ;}$ cur = getmonsun (); echo date ('Y-m-D', $ cur ['mon']); echo "rn"; echo date ('Y-m-D ', $ cur ['sun']); // method 2 use the php strtotime function echo strtotime ('last Monday'); echo'
'; Echo strtotime ('next Sunday ');
You can see a lot of things through the following two examples of taking out the timestamp on Monday and Sunday. you need to keep thinking. The first one is to take out the specified day...