Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php count days excluding weekends

function sumDays($days = 0, $format = 'd/m/Y') {
    $incrementing = $days > 0;
    $days         = abs($days);
    $actualDate   = date('Y-m-d');

    while ($days > 0) {
        $tsDate    = strtotime($actualDate . ' ' . ($incrementing ? '+' : '-') . ' 1 days');
        $actualDate = date('Y-m-d', $tsDate);

        if (date('N', $tsDate) < 6) {
            $days--;
        }
    }

    return date($format, strtotime($actualDate));
}
Comment

PREVIOUS NEXT
Code Example
Php :: how to create singleton laravel 
Php :: wordpress enable post thumbnail 
Php :: woocommerce return to shop custom url 
Php :: wordpress rename post format 
Php :: how to call js function from php 
Php :: php dies while parsing json 
Php :: add month to date 
Php :: group_concat mysql limit issue 
Php :: wordpress nav menu align right 
Php :: laravel 6 make http request 
Php :: laravel redis cache 
Php :: create weekly calendar in php 
Php :: delay in php 
Php :: php mysql prepared statements 
Php :: laravel redirect action 
Php :: magento2 move Exception #0 (Exception): Notice: Undefined offset: 2 in /var/www/nucleus/htdocs/vendor/magento/framework/Encryption/Encryptor.php on line 591 
Php :: how to wirte laravel dd function in php 
Php :: smarty switch case 
Php :: laravel 8 carbon if date is today 
Php :: php try to decode json 
Php :: echo php in html 
Php :: php call method from another class 
Php :: php include multiple files at once 
Php :: append in php 
Php :: PHP: How to remove specific element from an array? 
Php :: php inline if condition date time 
Php :: encryption and decryption in php example 
Php :: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes 
Php :: error laravel 404 in server 
Php :: laravel check if environment is production 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =