I have below code for getting the sundays. any body me to get saturdays

$start = new DateTime('2013-01-06');
$end = new DateTime('2013-01-20');
$days = $start->diff($end, true)->days;

$sundays = intval($days / 7) + ($start->format('N') + $days % 7 >= 7);

echo $sundays;

Start by writing out the algorithm in non-code terms to be sure you understand it. Then apply the algorithm manually to see if it corresponds to what you can observe directly. Do this for both saturdays and sundays. Once you have verified the algorithm, then you can code it. IMO, you are putting the cart before the horse.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.