Php obtains the specific date of this week and Monday. Php: how to get the specific date of Monday this week. This article mainly introduces php's method of getting the specific date of Monday this week. it involves php's date-based operation skills, very useful. php methods for obtaining the specific date of this week and Monday
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. For more information, see
This example describes how php obtains the specific date of this week. Share it with you for your reference. The details are as follows:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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:-/* 6*86400 */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.
This article describes how php obtains the specific date of the week. it involves php's date-based operation skills and is very useful...