本文整理汇总了PHP中gmt_to_local函数的典型用法代码示例。如果您正苦于以下问题:PHP gmt_to_local函数的具体用法?PHP gmt_to_local怎么用?PHP gmt_to_local使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gmt_to_local函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: human_gmt_to_human_local
function human_gmt_to_human_local($human_gmt, $time_zone = NULL)
{
if (!$time_zone) {
$time_zone = 'UTC';
}
return date('Y-m-d H:i:s', gmt_to_local(strtotime($human_gmt), $time_zone, TRUE)) . ($time_zone == 'UTC' ? ' (UTC)' : '');
}
示例2: current_time
function current_time($timezone, $daylight_saving)
{
$time = time();
$gmt = local_to_gmt($time);
$local = gmt_to_local($gmt, $timezone, $daylight_saving);
return standard_date("DATE_RFC822", $local);
}
示例3: local_time
function local_time($client_id, $time)
{
$CI =& get_instance();
$CI->load->model('client_model');
$client = $CI->client_model->GetClientDetails($client_id);
$timestamp = !is_numeric($time) ? strtotime($time) : $time;
$timestamp = $timestamp - date("Z");
$timezone = $client->gmt_offset;
$daylight_saving = date("I") == 1 ? TRUE : FALSE;
// format
$format = defined("_CONTROLPANEL") ? "M j, Y" : "c";
if (defined("_CONTROLPANEL") and strstr($time, ' ')) {
$format = 'M j, Y h:i a';
}
$formatted_date = date($format, gmt_to_local($timestamp, $timezone, $daylight_saving));
// if the date is null, we won't return it
// any date before May 29, 1988 is null
$is_null = $timestamp < 580881600 ? TRUE : FALSE;
if ($is_null === TRUE and defined("_CONTROLPANEL")) {
return 'N/A';
} elseif ($is_null === TRUE) {
return '0';
} else {
return $formatted_date;
}
}
示例4: getTransRateByTime
function getTransRateByTime($productId)
{
$r = $this->getTargetListByProductId($productId);
$num = $r->num_rows();
$ret = array();
$nret = array();
foreach ($r->result() as $row) {
$transEvents = $this->getTransEventsIdByTargetId($row->tid);
$event_from = $transEvents["from"];
$event_to = $transEvents["to"];
$timezonestimestamp = gmt_to_local(local_to_gmt(), $this->config->item('timezones'));
$timezonestime = date('Y-m-d H:i:m', $timezonestimestamp);
$from_count = 0;
$to_count = 0;
for ($i = 29; $i >= 0; $i--) {
$dataStr = date('Y-m-d-H-i', strtotime("-{$i} minutes", strtotime($timezonestime)));
$from_size = $this->redis->get("razor_r_p_e_" . $productId . "_" . $event_from . "_" . $dataStr);
$from_count += $from_size;
$to_size = $this->redis->get("razor_r_p_e_" . $productId . "_" . $event_to . "_" . $dataStr);
$to_count += $to_size;
if ($from_count == 0) {
$rate = 0;
} else {
$rate = $to_count / $from_count;
}
}
$r = array('name' => $row->targetname, 'time' => '-' . $i . lang("v_rpt_realtime_minutes"), 'from_count' => $from_count, 'to_count' => $to_count, 'rate' => $rate, 'event_to' => $event_to);
if ($to_count == 0) {
continue;
}
array_push($ret, $r);
}
return $ret;
}
示例5: __construct
public function __construct()
{
parent::__construct();
$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate, no-transform, max-age=0, post-check=0, pre-check=0");
$this->output->set_header("Pragma: no-cache");
$this->load->model('noise_model');
if ($this->auth->is_logged() == FALSE) {
$this->status_login = "not_login";
$this->key_activation = $this->generate_key(20);
} else {
$this->status_login = "logueado";
}
// LOAD LIBRARY SLUG
$config = array('table' => 'notion', 'id' => 'id_notion', 'field' => 'slug', 'title' => 'title', 'replacement' => 'dash');
$this->load->library('slug', $config);
## FECHA
date_default_timezone_set('UTC');
$timestamp = now();
$timezone = 'UM5';
$daylight_saving = false;
$now = gmt_to_local($timestamp, $timezone, $daylight_saving);
$datestring = "%Y-%m-%d %h:%i:%s";
$this->now = mdate($datestring, $now);
//$this->name_country = $this->country->ip_info('Visitor', 'Country');
//$this->code_country = $this->country->ip_info("Visitor", "Country Code");
$this->name_country = 'PERU';
$this->code_country = 'PE';
//$this->state = $this->country->ip_info('181.66.157.144', 'State');
}
示例6: anadir_contacto
public function anadir_contacto($data)
{
$timestamp = time();
$fecha = date("Y-m-d H:i:s");
$this->db->set('identificador', $data['identificador']);
$this->db->set('nombre', $data['nombre_completo']);
$this->db->set('correo', $data['email']);
$this->db->set('telefono', $data['telefono']);
$this->db->set('comentario', $data['comentario']);
$this->db->set('fecha', $fecha);
$this->db->set('id_servicio', $data['servicio']);
$this->db->set('id_origen', $data['origen']);
$this->db->set('unixtime', gmt_to_local($timestamp, $this->timezone, TRUE));
$this->db->set('ip', $data['ip']);
$this->db->set('navegador', $data['navegador']);
$this->db->set('microsite', $data['microsite']);
$this->db->set('trafico', $data['origin']);
$this->db->insert($this->contacto);
if ($this->db->affected_rows() > 0) {
return TRUE;
} else {
return FALSE;
}
$result->free_result();
}
示例7: __construct
public function __construct()
{
parent::__construct();
$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate, no-transform, max-age=0, post-check=0, pre-check=0");
$this->output->set_header("Pragma: no-cache");
$this->load->model('web_model');
if ($this->auth->is_logged() == FALSE) {
$this->status_login = "not_login";
$this->key_activation = $this->generate_key(20);
} else {
$this->status_login = "logueado";
}
/* Obtenemos la fecha actual */
date_default_timezone_set('UTC');
$timestamp = now();
$timezone = 'UM5';
$daylight_saving = FALSE;
$now = gmt_to_local($timestamp, $timezone, $daylight_saving);
$datestring = "%Y-%m-%d %h:%i:%s";
$this->now = mdate($datestring, $now);
//$this->name_country = $this->country->ip_info('Visitor', 'Country');
//$this->code_country = $this->country->ip_info("Visitor", "Country Code");
$this->name_country = 'PERU';
$this->code_country = 'PE';
}
示例8: getActivityByMinutes
function getActivityByMinutes($productId)
{
$timezonestimestamp = gmt_to_local(local_to_gmt(), $this->config->item('timezones'));
$timezonestime = date('Y-m-d H:i:m', $timezonestimestamp);
$all_ret = array();
$version = "all";
for ($i = 29; $i >= 0; $i--) {
$all_size = 0;
$dataStr = date('Y-m-d-H-i', strtotime("-{$i} minutes", strtotime($timezonestime)));
$allAcs = $this->redis->keys("razor_r_ac_p_" . $productId . "_" . $dataStr . "*");
if ($allAcs && count($allAcs) > 0) {
for ($k = 0; $k < count($allAcs); $k++) {
$key = $allAcs[$k];
$len = $this->redis->hlen($key);
$all_size += $len;
}
}
if ($i == 0) {
$onlinedata = array('minutes' => lang("v_rpt_realtime_now"), 'size' => $all_size);
} else {
$onlinedata = array('minutes' => "- " . $i . lang("v_rpt_realtime_minutes"), 'size' => $all_size);
}
array_push($all_ret, $onlinedata);
}
return json_encode($all_ret);
}
示例9: postDate
function postDate($time, $format = "%M %d %Y %h:%i%a")
{
$timezone = $this->session->userdata("timezone");
if (empty($timezone)) {
$timezone = "UTC";
}
return mdate($format, gmt_to_local($time, $timezone));
}
示例10: trigger_convert_to_local
function trigger_convert_to_local($time = '', $gmt_offset, $format = 'Y-m-d H:i:s')
{
$CI =& get_instance();
$time = !is_numeric($time) ? strtotime(str_replace('/', '-', $time)) : $time;
$timezone = $gmt_offset;
$daylight_saving = date("I") == 1 ? TRUE : FALSE;
$time = gmt_to_local($time, $timezone, $daylight_saving);
return date($format, $time);
}
示例11: get_est_time
function get_est_time()
{
$now = time();
$gmt = local_to_gmt($now);
$timezone = 'UM4';
$daylight_saving = FALSE;
$tt = gmt_to_local($gmt, $timezone, $daylight_saving);
return $tt;
}
示例12: convert_from_gmt
function convert_from_gmt($gmt_date,$timezone)
{
//echo $gmt_date;
if($gmt_date && $timezone){
return mdate("%d/%m/%Y %H:%i",gmt_to_local(strtotime($gmt_date),$timezone,false));
}
else{
return "";
}
}
示例13: aktifkan
public function aktifkan($uid)
{
$this->db->where('uid', $uid);
$query = $this->db->get('user');
if ($query->num_rows() > 0) {
$this->db->where('uid', $uid);
$this->db->update('user', array('stat' => '1', 'aktif' => gmt_to_local(time(), 'UP7', FALSE)));
return TRUE;
} else {
return FALSE;
}
}
示例14: submit
public function submit($username, $password, $nama, $alamat, $email, $kota, $hp)
{
$datestring = '%d/%m/%y';
$time = time();
$tarif = $this->config->item('biaya');
$transfer = $tarif + substr($hp, -3);
$unik = random_string('alnum', 6);
$pass = do_hash($password . $unik);
$secure_pass = $unik . '_' . $pass;
$data = array('userid' => strtolower($username), 'password' => $secure_pass, 'stat' => '0', 'nama' => $nama, 'alamat' => $alamat, 'kota' => $kota, 'telepon' => $hp, 'email' => strtolower($email), 'transfer' => $transfer, 'daftar' => gmt_to_local(time(), 'UP7', FALSE), 'uid' => do_hash($username));
$this->db->insert('user', $data);
return TRUE;
}
示例15: __construct
public function __construct()
{
parent::__construct();
$this->load->model('manager_model');
/* Obtenemos la fecha actual */
date_default_timezone_set('UTC');
$timestamp = now();
$timezone = 'UM5';
$daylight_saving = FALSE;
$now = gmt_to_local($timestamp, $timezone, $daylight_saving);
$datestring = "%Y-%m-%d %h:%i:%s";
$this->now = mdate($datestring, $now);
}