Home > php教程 > php手册 > PHP获取时间排除周六、周日的两个方法

PHP获取时间排除周六、周日的两个方法

WBOY
Release: 2016-06-06 20:20:34
Original
1519 people have browsed it

这篇文章主要介绍了PHP获取时间排除周六、周日的两个方法,应用在特殊场合,需要的朋友可以参考下

今天和大家分享一个获取10天后的一个时间戳的函数,程序的关键是,,他可以不去算周六日哦。如果你有别的需求。可以改成N天的哦。反正就不算周六日。哈哈。

//方法一: =-1 and $num=10) break; $days[]=date("Y-m-d",$now+$day*$i); $total +=1 ;// $total==12 ?$total+1:$total; }else { $total = $total==12 ?$total+1:$total; } } $i=1; foreach($days as $day) { echo "$i===>".$day."\n"; $i++; } //方法二: function get_days ($date="") { $now = empty($date)?time():strtotime($date); $days = array(); $i = 2; while(count($days)=-1 and $num

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template