[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: phpgwapi/inc class.datetime.inc.php,1.5.2.10,1.
From: |
Ralf Becker <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: phpgwapi/inc class.datetime.inc.php,1.5.2.10,1.5.2.11 |
Date: |
Wed, 26 Feb 2003 11:29:21 -0500 |
Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv27864
Modified Files:
Tag: Version-0_9_14-branch
class.datetime.inc.php
Log Message:
reimplemented the days_between function because it led to an infinite recursion
in some cases and its simpler/faster now
Index: class.datetime.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.datetime.inc.php,v
retrieving revision 1.5.2.10
retrieving revision 1.5.2.11
diff -C2 -r1.5.2.10 -r1.5.2.11
*** class.datetime.inc.php 21 Sep 2002 21:54:11 -0000 1.5.2.10
--- class.datetime.inc.php 26 Feb 2003 16:29:19 -0000 1.5.2.11
***************
*** 362,399 ****
@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;
}
--- 362,371 ----
@function days_between
@abstract Get the number of days between two dates
! @author Steven Cramer/Ralf Becker
@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)
{
! return intval((mktime(0,0,0,$m2,$d2,$y2) -
mktime(0,0,0,$m1,$d1,$y1)) / 86400);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: phpgwapi/inc class.datetime.inc.php,1.5.2.10,1.5.2.11,
Ralf Becker <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: calendar/setup phpgw_de.lang,1.12.2.8,1.12.2.9 phpgw_en.lang,1.13.2.15,1.13.2.16
- Next by Date:
[Phpgroupware-cvs] CVS: calendar/setup phpgw_de.lang,1.16,1.17 phpgw_en.lang,1.24,1.25
- Previous by thread:
[Phpgroupware-cvs] CVS: calendar/setup phpgw_de.lang,1.12.2.8,1.12.2.9 phpgw_en.lang,1.13.2.15,1.13.2.16
- Next by thread:
[Phpgroupware-cvs] CVS: calendar/setup phpgw_de.lang,1.16,1.17 phpgw_en.lang,1.24,1.25
- Index(es):