note 26118 rejected from ref.datetime by victor

From: Date: Fri, 18 Oct 2002 17:50:09 +0000
Subject: note 26118 rejected from ref.datetime by victor
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-38268@lists.php.net to get a copy of this message
<?PHP //a simple script to create two separate dates: statement date and //due date-- useful for billing purposes. //set the needed variables $month = 10; $day = 18; $year=2002; $nperiod = 12; //set two separate array variables to store statement date //and due date respectively $newbday=array(); $newdday=array(); //format for timestamp $bday = mktime(0,0,0,$month, $day, $year); $dday = mktime(0,0,0,$month, $day, $year); //format for a readable date "MM/DD/YYYY" $bday = date("m/d/Y",$bday); $dday = date("m/d/Y",$dday); //loop thru until $i reaches 12 for($i=0;$i<$nperiod;$i++) { //get the date string and explode it into three separate variables list($month, $day, $year) = explode("/",$bday); list($month, $day, $year) = explode("/",$dday); //set the date to increment $bday = mktime(0,0,0,$month, $day+30, $year); $dday = mktime(0,0,0,$month, $day+30+5, $year); /*store the incremented date to the array variables defined earlier*/ $nbday = date("m/d/Y",$bday); $ndday = date("m/d/Y",$dday); $newbday = $nbday; $newdday = $ndday; //assign new values for $bday and $dday $bday = $newbday; $dday = $newdday; print ("Statement date :" .$bday. " Due date: " .$dday); print("<br />"); } ?>

« previous php.notes (#38268) next »