Home php How To Count Total Fridays Between Two Dates In Php ?

How To Count Total Fridays Between Two Dates In Php ?

by Shahriar Sagor

Today Now in this post i will show how to count total fridays between two dates in php. Some times we may need to count total days in between two dates. By using Php we know get this. Here we will know about how we can calculate total days between two dates. If you need to know how to get total Sunday in between two dates by using php. Then i hoe you are in the right place.

If we are working on any HRM application and Need to count total working hour in this month then here it is need. How many a particular days in between two dates.

Souce Code
<?php
$start_date= strtotime("01-05-2022");
$for_start = strtotime('Friday', $start_date);

$end_date= strtotime("31-05-2022");
$count = 0;
for ($i = $for_start; $i <= $end_date; $i = strtotime('+1 week', $i)) {
    $count++;
}
echo $count;
?>

Read Also: How To Implement Laravel 9 form validation ?

Thanks for read. I hope it help you. For more you can follow us on facebook

close

You may also like