formatting, GLOBALS

This commit is contained in:
Miles Lott 2001-09-23 19:38:24 +00:00
parent 0d1dcab48d
commit b9ae8c8238

View File

@ -41,7 +41,6 @@
@class datetime
@abstract datetime class that contains common date/time functions
*/
class datetime
{
var $tz_offset;
@ -49,16 +48,13 @@ class datetime
function datetime()
{
global $phpgw_info;
$this->tz_offset = ((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset']));
$this->tz_offset = ((60 * 60) * intval($GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']));
}
function get_weekday_start($year,$month,$day)
{
global $phpgw_info;
$weekday = $this->day_of_week($year,$month,$day);
switch($phpgw_info['user']['preferences']['calendar']['weekdaystarts'])
switch($GLOBALS['phpgw_info']['user']['preferences']['calendar']['weekdaystarts'])
{
// Saturday is for arabic support
case 'Saturday':
@ -127,10 +123,14 @@ class datetime
function is_leap_year($year)
{
if ((intval($year) % 4 == 0) && (intval($year) % 100 != 0) || (intval($year) % 400 == 0))
{
return 1;
}
else
{
return 0;
}
}
function days_in_month($month,$year)
{
@ -245,20 +245,18 @@ class datetime
function localdates($localtime)
{
global $phpgw;
$date = Array('raw','day','month','year','full','dow','dm','bd');
$date['raw'] = $localtime;
$date['year'] = intval($phpgw->common->show_date($date['raw'],'Y'));
$date['month'] = intval($phpgw->common->show_date($date['raw'],'m'));
$date['day'] = intval($phpgw->common->show_date($date['raw'],'d'));
$date['full'] = intval($phpgw->common->show_date($date['raw'],'Ymd'));
$date['year'] = intval($GLOBALS['phpgw']->common->show_date($date['raw'],'Y'));
$date['month'] = intval($GLOBALS['phpgw']->common->show_date($date['raw'],'m'));
$date['day'] = intval($GLOBALS['phpgw']->common->show_date($date['raw'],'d'));
$date['full'] = intval($GLOBALS['phpgw']->common->show_date($date['raw'],'Ymd'));
$date['bd'] = mktime(0,0,0,$date['month'],$date['day'],$date['year']);
$date['dm'] = intval($phpgw->common->show_date($date['raw'],'dm'));
$date['dm'] = intval($GLOBALS['phpgw']->common->show_date($date['raw'],'dm'));
$date['dow'] = $this->day_of_week($date['year'],$date['month'],$date['day']);
$date['hour'] = intval($phpgw->common->show_date($date['raw'],'H'));
$date['minute'] = intval($phpgw->common->show_date($date['raw'],'i'));
$date['second'] = intval($phpgw->common->show_date($date['raw'],'s'));
$date['hour'] = intval($GLOBALS['phpgw']->common->show_date($date['raw'],'H'));
$date['minute'] = intval($GLOBALS['phpgw']->common->show_date($date['raw'],'i'));
$date['second'] = intval($GLOBALS['phpgw']->common->show_date($date['raw'],'s'));
return $date;
}
@ -267,6 +265,5 @@ class datetime
{
return $this->localdates($localtime - $this->tz_offset);
}
}
?>