Introduction: This is to calculate the number of days in these periods based on the specified two dates.ProgramFunctionCodeThe details page of PHP, related knowledge, skills, experience, and some PHP source code.
Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 343705 'scrolling = 'no'> $ alldays = intval (sstrtotime ($ _ post ['day'])-sstrtotime ($ _ post ['daya']) /3600/24) + 1; // Total Number of days
$ Weeks = intval ($ alldays/7); // week count
$ Mdays = $ alldays-7 * $ weeks; // the remaining days of the week except the number of weeks.
If ($ mdays = '0 '){
$ _ Post ['psdays '] = 5 * $ weeks;
$ _ Post ['zmdays'] = 2 * $ weeks;
} Else {
$ Aday = ''; // the day of the week on the first day.
$ Adays = date ("D", sstrtotime ($ _ post ['daya ']);
If ($ adays = 'mon '){
$ Aday = "1 ";
} Elseif ($ adays = 'tue '){
$ Aday = "2 ";
} Elseif ($ adays = 'wed '){
$ Aday = "3 ";
} Elseif ($ adays = 'thu '){
$ Aday = "4 ";
} Elseif ($ adays = 'fri '){
$ Aday = "5 ";
} Elseif ($ adays = 'sat '){
$ Aday = "6 ";
} Else {
$ Aday = "7 ";
}
If ($ aday = '7 '){
$ _ Post ['zmdays'] = 1 + 2 * $ weeks;
$ _ Post ['psdays '] = $ mdays-1 + 5 * $ weeks;
} Else {
$ Nfanwei = 7-$ aday; // range, starting from the day of the week $ aday (including this day), and from $ nfanwei to Saturday
If ($ mdays> $ nfanwei ){
$ _ Post ['zmdays'] = 2 + 2 * $ weeks;
$ _ Post ['psdays '] = $ mdays-2 + 5 * $ weeks;
} Elseif ($ mdays ==$ nfanwei ){
$ _ Post ['zmdays'] = 1 + 2 * $ weeks;
$ _ Post ['psdays '] = $ mdays-1 + 5 * $ weeks;
} Else {
$ _ Post ['zmdays'] = 0 + 2 * $ weeks;
$ _ Post ['psdays '] = $ mdays + 5 * $ weeks;
}
}
}
Address: http://www.corange.cn/archives/2011/08/3781.html
Love J2EE follow Java Michael Jackson video station JSON online tools
Http://biancheng.dnbcw.info/php/343705.html pageno: 5.