Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Between Two Dates day count and removed Sunday using php

<?php       
function getalldates($strtdate,$enddate){
    $array = array(); 

    $period = new DatePeriod(
        new DateTime($strtdate),
        new DateInterval('P1D'),
        new DateTime($enddate)
    );

    foreach ($period as $key => $value) {
        $Store = $value->format('Y-m-d'); 
        $unixTimestamp = strtotime($Store);
		$dayOfWeek = date("l", $unixTimestamp);
        if($dayOfWeek != "Sunday"){
        $array[] = $Store;    
        }
          
    }
    return count($array);
}
$fdate = "2022-02-01";
$ldate = "2022-02-28";
$c = getalldates($fdate,$ldate);
echo $c;
?>
Comment

PREVIOUS NEXT
Code Example
Php :: yii1 anchor tag 
Php :: php foreach show only 4 
Php :: if condition in laravel blade in select option 
Php :: if request method post php 
Php :: number format rupiah 
Php :: moodle admin cli 
Php :: on keyup jquery for search php 
Php :: php mysql foreach is bad pardics ? 
Php :: get categories only assigned to post Wordpress 
Php :: php ctype float 
Php :: php preg_match 
Php :: php validate email 
Php :: trim | from right in php 
Php :: php multiple array to single array 
Php :: update php version cpanel 
Php :: upgrade php 5.6 to 7 centos 7 
Php :: Notice: Trying to access array offset on value of type bool in /usr/www/users/easygrb/storage/modification/catalog/controller/startup/startup.php on line 169 
Php :: loop through object php 
Php :: return true false laravel 
Php :: php ajouter += ou =+ 
Java :: java: cannot access javax.naming.Referenceable class file for javax.naming.Referenceable not found 
Java :: android glide dependency 
Java :: what are the hibernate dependencies 
Java :: java pause 
Java :: java reflection get field value 
Java :: java random boolean 
Java :: equivalent to params keyword in java 
Java :: java convert string to int 
Java :: error: package android.support.v4.content does not exist import android.support.v4.content.FileProvider; ^ 
Java :: java add text to GUI 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =