[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.12,1.13
From: |
Ralf Becker <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: phpgwapi/inc class.datetime.inc.php,1.12,1.13 |
Date: |
Wed, 26 Feb 2003 11:44:13 -0500 |
Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv31060
Modified Files:
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.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** class.datetime.inc.php 21 Sep 2002 21:54:20 -0000 1.12
--- class.datetime.inc.php 26 Feb 2003 16:44:11 -0000 1.13
***************
*** 426,463 ****
@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;
}
--- 426,435 ----
@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.12,1.13,
Ralf Becker <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: calendar/inc class.bocalendar.inc.php,1.87,1.88 class.uicalendar.inc.php,1.93,1.94
- Next by Date:
[Phpgroupware-cvs] CVS: calendar/inc class.uicalendar.inc.php,1.66.2.51,1.66.2.52
- Previous by thread:
[Phpgroupware-cvs] CVS: calendar/inc class.bocalendar.inc.php,1.87,1.88 class.uicalendar.inc.php,1.93,1.94
- Next by thread:
[Phpgroupware-cvs] CVS: calendar/inc class.uicalendar.inc.php,1.66.2.51,1.66.2.52
- Index(es):