note 109525 modified in function.date by danbrown

From: Date: Mon, 30 Jul 2012 15:53:47 +0000
Subject: note 109525 modified in function.date by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-189496@lists.php.net to get a copy of this message
This function will add working day to a given timestamp

<?php
 function addworkinday($timestamp,$daystoadd){
 	
 	$dayoftheweek = date("N",$timestamp);
 	$sum =$dayoftheweek +$daystoadd;
 	
 while ($sum >= 6) {
 	
 	$daystoadd=$daystoadd+1;
 $sum=$sum-1;
}
 return $timestamp +(60*60*24*$daystoadd);

 }
?> --was-- This function will add working day to a given timestamp function addworkinday($timestamp,$daystoadd){ $dayoftheweek = date("N",$timestamp); $sum =$dayoftheweek +$daystoadd; while ($sum >= 6) { $daystoadd=$daystoadd+1; $sum=$sum-1; } return $timestamp +(60*60*24*$daystoadd); } http://php.net/manual/en/function.date.php

« previous php.notes (#189496) next »