phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: phpgwapi/inc class.datetime.inc.php,1.5.2.8,1.5.


From: Mark A Peters <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/inc class.datetime.inc.php,1.5.2.8,1.5.2.9
Date: Tue, 17 Sep 2002 06:03:29 -0400

Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv15236/phpgwapi/inc

Modified Files:
      Tag: Version-0_9_14-branch
        class.datetime.inc.php 
Log Message:
GNU Patch #290.

Index: class.datetime.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.datetime.inc.php,v
retrieving revision 1.5.2.8
retrieving revision 1.5.2.9
diff -C2 -r1.5.2.8 -r1.5.2.9
*** class.datetime.inc.php      2 Sep 2002 02:39:44 -0000       1.5.2.8
--- class.datetime.inc.php      17 Sep 2002 10:03:27 -0000      1.5.2.9
***************
*** 359,362 ****
--- 359,401 ----
                }
  
+               /*!
+               @function days_between
+               @abstract Get the number of days between two dates
+               @author Steven Cramer
+               @param $m1 - Month_1, $d1 - Day_1, $y1 - Year_1, $m2 - Month_2, 
$d2 - Day_2, $y2 - Year_2
+               */
+               function days_between($m1,$d1,$y1,$m2,$d2,$y2)
+               {
+ //                    $start = "$d1.$m1.$y1";
+ 
+                       if ($y1 == $y2 && $m1 == $m2)
+                       {
+                               $days = $d2 - $d1;
+                       }
+                       else
+                       {
+                               $days = $this->days_in_month($m1,$y1) - $d1;
+                               while ($m1 != $m2 || $y1 != $y2)
+                               {
+                                       if ($m1+1 == 13)
+                                       {
+                                               $m1 = 1;
+                                               $y1++;
+                                       }
+                                       else 
+                                       {
+                                               $m1++;
+                                       }
+ 
+                                       if ($m1 != $m2 || $y1 != $y2)
+                                       {
+                                               $days += 
$this->days_in_month($m1,$y1);
+                                       }
+                               }
+                               $days += $d2;
+                       }
+                       return $days;
+               }
+ 
                function 
date_compare($a_year,$a_month,$a_day,$b_year,$b_month,$b_day)
                {





reply via email to

[Prev in Thread] Current Thread [Next in Thread]