コード例 #1
0
        //echo"<pre>";
        //var_dump($query);
        for ($i = 0; $i < $count; $i++) {
            $data['Result']['Data'][$i]['gmt_id'] = CLS_MYSQL::GetResultValue($query, $i, 'id');
            $data['Result']['Data'][$i]['gmt'] = CLS_MYSQL::GetResultValue($query, $i, 'gmt');
            $data['Result']['Data'][$i]['secondsDiff'] = CLS_MYSQL::GetResultValue($query, $i, 'secondsDiff');
            //$data['Result']['Data'][$i]['Location']=CLS_MYSQL::GetResultValue($query,$i,'Location');
            //print_r($location);
            //$spl=preg_split('/(,(?: ))/', $location);
            $location = CLS_MYSQL::GetResultValue($query, $i, 'Location');
            /*if($split==1)
            		{
            		$data['Result']['Data'][$i]['Location']=preg_split('/(,(?: ))/', $location);
            		}
            		else
            		{
            		$data['Result']['Data'][$i]['Location']=$location;
            		}*/
            $data['Result']['Data'][$i]['Location'] = $split == 1 ? preg_split('/(,(?: ))/', $location) : $location;
            //print_r($spl);
            //exit();
        }
        $this->display($data);
    }
    public function display($data)
    {
        echo DB_Mysql::encode($data);
    }
}
$gmt = new gmt();
$gmt->getFullGmtData($split);
コード例 #2
0
<?php

include 'gmt.class.php';
$gmt = new gmt();
echo '<h3>Your server gmt is : ' . date('P') . '(' . date('e') . ')</h3>';
echo '<h3>Your server time is : ' . date('Y-m-d H:i:s') . '</h3>';
$date = '2009-06-20 05:00:00';
//EX 1:
echo '<p>GMT according to your server : ' . $gmt->getByGMT() . '</p>';
//EX 2:
$gmt->setZoneId(3);
$gmt->setDateToConvert($date);
echo '<p>GMT Minus 10 hour as on ' . $date . ' : ' . $gmt->getByGMT() . '</p>';
//Reset zone and date
$gmt->resetZoneId();
$gmt->resetDateToConvert();
//EX 1:
echo '<p>GMT according to your server : ' . $gmt->getByGMT() . '</p>';
//EX 3:
$gmt->setDateToConvert($date);
echo '<p>GMT as on ' . $date . ' according to your server : ' . $gmt->getByGMT() . '</p>';