[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,1.5.2.1
From: |
Mark A Peters <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: phpgwapi/inc class.datetime.inc.php,1.5,1.5.2.1 |
Date: |
Tue, 16 Apr 2002 11:41:42 -0400 |
Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv25952/phpgwapi/inc
Modified Files:
Tag: Version-0_9_14-branch
class.datetime.inc.php
Log Message:
This part of a major fix for the calendar.
Index: class.datetime.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.datetime.inc.php,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -C2 -r1.5 -r1.5.2.1
*** class.datetime.inc.php 28 Sep 2001 02:18:55 -0000 1.5
--- class.datetime.inc.php 16 Apr 2002 15:41:40 -0000 1.5.2.1
***************
*** 46,55 ****
var $tz_offset;
var $days = Array();
function datetime()
{
$this->tz_offset = ((60 * 60) *
intval($GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']));
}
!
function get_weekday_start($year,$month,$day)
{
--- 46,116 ----
var $tz_offset;
var $days = Array();
+ var $gmtnow;
+ var $gmtdate;
function datetime()
{
$this->tz_offset = ((60 * 60) *
intval($GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']));
+ /*
+ * This is not advanced enough to automatically recalc Daylight Savings time
+ if(date('I') == 1)
+ {
+ $this->tz_offset += 3600;
+ }
+ */
+ $this->gmtdate = gmdate('D, d M Y H:i:s',time()).' GMT';
+ $this->gmtnow =
$this->convert_rfc_to_epoch($this->gmtdate);
}
!
! function convert_rfc_to_epoch($date_str)
! {
! $comma_pos = strpos($date_str,',');
! if($comma_pos)
! {
! $date_str = substr($date_str,$comma_pos+1);
! }
!
! // This may need to be a reference to the different
months in native tongue....
! $month= array(
! 'Jan' => 1,
! 'Feb' => 2,
! 'Mar' => 3,
! 'Apr' => 4,
! 'May' => 5,
! 'Jun' => 6,
! 'Jul' => 7,
! 'Aug' => 8,
! 'Sep' => 9,
! 'Oct' => 10,
! 'Nov' => 11,
! 'Dec' => 12
! );
! $dta = array();
! $ta = array();
!
! // Convert "15 Jul 2000 20:50:22 +0200" to unixtime
! $dta = explode(' ',$date_str);
! $ta = explode(':',$dta[4]);
!
! if(substr($dta[5],0,3) <> 'GMT')
! {
! $tzoffset = substr($dta[5],0,1);
! $tzhours = intval(substr($dta[5],1,2));
! $tzmins = intval(substr($dta[5],3,2));
! switch ($tzoffset)
! {
! case '-':
! (int)$ta[0] += $tzhours;
! (int)$ta[1] += $tzmins;
! break;
! case '+':
! (int)$ta[0] -= $tzhours;
! (int)$ta[1] -= $tzmins;
! break;
! }
! }
! return
mktime($ta[0],$ta[1],$ta[2],$month[$dta[2]],$dta[1],$dta[3]);
! }
!
function get_weekday_start($year,$month,$day)
{
***************
*** 80,84 ****
break;
}
- return $sday;
break;
case 'Monday':
--- 141,144 ----
***************
*** 104,108 ****
break;
}
- return $sday - (60 * 60 * 2);
break;
case 'Sunday':
--- 164,167 ----
***************
*** 117,123 ****
6 => 'Sat'
);
! return mktime(2,0,0,$month,$day -
$weekday,$year);
break;
}
}
--- 176,183 ----
6 => 'Sat'
);
! $sday = mktime(2,0,0,$month,$day -
$weekday,$year);
break;
}
+ return $sday - 7200;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: phpgwapi/inc class.datetime.inc.php,1.5,1.5.2.1,
Mark A Peters <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: inv/inc class.boinvoice.inc.php,1.1,1.2 class.uiinvoice.inc.php,1.2,1.3
- Next by Date:
[Phpgroupware-cvs] CVS: phpgwapi/inc class.datetime.inc.php,1.5,1.6
- Previous by thread:
[Phpgroupware-cvs] CVS: inv/inc class.boinvoice.inc.php,1.1,1.2 class.uiinvoice.inc.php,1.2,1.3
- Next by thread:
[Phpgroupware-cvs] CVS: phpgwapi/inc class.datetime.inc.php,1.5,1.6
- Index(es):