取出周一和周日的时间戳:能过下面两款取出周一和周日的时间戳实例可以看得出来很多的东西,要不断的思想哦,第一个自定的取出指定日期的时间戳比较好,但是如何是取出周一和周日第二个就更实用了。
- function getmonsun(){
- $curtime=time();
-
- $curweekday = date('w');
-
-
- $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']);
-
-
-
- echo strtotime('last monday');
- echo '
';
- echo strtotime('next sunday');
|