php代码
<? /* 作用由起止日期算出其中的周 * @param start_date 开始日期 * @param end_date 结束日期 * @return 一个二维数组,其中一维为每周起止时间 * @author anngly * @date 2013-06-08 * 注意:end_date>state_date **/ function getWeek($startdate,$enddate) { //参数不能为空 if(!empty($startdate) && !empty($enddate)){ //先把两个日期转为时间戳 $startdate=strtotime($startdate); $enddate=strtotime($enddate); //开始日期不能大于结束日期 if($startdate<=$enddate){ $end_date=strtotime("next monday",$enddate); if(date("w",$startdate)==1){ $start_date=$startdate; }else{ $start_date=strtotime("last monday",$startdate); } //计算时间差多少周 $countweek=($end_date-$start_date)/(7*24*3600); for($i=0;$i<$countweek;$i++){ $sd=date("Y-m-d",$start_date); $ed=strtotime("+ 6 days",$start_date); $eed=date("Y-m-d",$ed); $arr[]=array($sd,$eed); $start_date=strtotime("+ 1 day",$ed); } return $arr; } } } @var_dump(getWeek( "2012-08-04","2013-08-08")) ; ?>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Linux new version
SublimeText3 Linux latest version

Notepad++7.3.1
Easy-to-use and free code editor

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6
Visual web development tools
