This article mainly introduces PHP to get this week Monday date of the method, involved in the PHP date-oriented operation skills, very practical value, interested friends can integrate the code fragment into their own date class to facilitate future calls, the need for friends can refer to the
The examples in this article describe how PHP gets the date of the week Monday. Share to everyone for your reference. Specifically 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 your PHP program design.