This article mainly introduces how php obtains the specific date of this week and involves php's date-based operation skills, which is of great practical value, if you are interested, you can integrate the code snippet into your own date class to facilitate future calls. if you need it, you can refer to the following example to illustrate how php can obtain the specific date of this week and Monday. Share it with you for your reference. The details are as follows:
Private function mondayTime ($ timestamp = 0, $ is_return_timestamp = true) {static $ cache; $ id = $ timestamp. $ is_return_timestamp; if (! Isset ($ cache [$ id]) {if (! $ Timestamp) $ timestamp = time (); $ monday_date = date ('Y-m-D', $ timestamp-86400 * date ('W', $ timestamp) + (date ('W', $ timestamp)> 0? 86400:-/* 6x86400 */518400); if ($ is_return_timestamp) {$ cache [$ id] = strtotime ($ monday_date );} else {$ cache [$ id] = $ monday_date;} return $ cache [$ id];} echo $ this-> mondayTime (time () + 24*3600*2, false); exit;
I hope this article will help you with php programming.