Removing weekends

Any suggestion of how I shall remove saturdays and sundays and count day 150 + 450? I don?t want to count saturday and sundays still count +150 days.

<?php $startDate = '2008-03-02'; $startTime = strtotime($startDate); // convert date to UNIX timestamp integer $plus150days = date('Y-m-d', strtotime('+150 days', $startTime)); $minus450days = date('Y-m-d', strtotime('-450 days', $startTime)); echo "Start: $startDate
+150: $plus150days
-450: $minus450days"; Thanks!

You know that for each seven days, there are two days of weekend. It’ll take some tricks to figure out whether or not your start date and end dates are weekend days, but once that’s out of the way, you should be relatively safe with the rule: 5 weekdays, 2 weekenddays.

if ( date("N", time()) <= 5 ) {
   // Do some code for Monday through Friday
} else {
   // Do some code for Saturday and Sunday
}

Ref http://us.php.net/manual/en/function.date.php

Sponsor our Newsletter | Privacy Policy | Terms of Service