Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
$twoweeks = date("M-d-Y",mktime(0,0,0, date("m"), date("d")+14, date("Y")));
echo $twoweeks."<br>";
<?php
function add_specified_days ($start_date, $number_of_days, $valid_days)
{
$days_of_week = array (1, 2, 4, 8, 16, 32, 64);
$counter = 0;
$test_date = strtotime($start_date);
while ($counter < $number_of_days)
{
$test_date += 86400;
$dow = $days_of_week[date ('w', $test_date)];
if ($dow & $valid_days)
{
$counter++;
}
}
return date('Y-m-d', $test_date);
}
// Calculate the third parameter ($valid_days) by bitwize-oring
// (or adding -- the two operations are equivalent on this
// data) numbers from this table:
//
// su m t w th f sa
// 1 2 4 8 16 32 64
//
// If you want to count only weekdays, use 62
// If you want to count only weekends, use 65
// If you want to count only Sundays, use 64
$a = '2004-07-01';
//14 weekdays later
print add_specified_days($a, 14, 62);
print "\n";
//14 weekend days later
print add_specified_days($a, 14, 65);
print "\n";
//a month of Sundays later
print add_specified_days($a, 28, 64);
print "\n";
?>
2004-07-21
2004-08-15
2005-01-08