当前位置: 首页>>代码示例>>PHP>>正文


PHP local_to_gmt函数代码示例

本文整理汇总了PHP中local_to_gmt函数的典型用法代码示例。如果您正苦于以下问题:PHP local_to_gmt函数的具体用法?PHP local_to_gmt怎么用?PHP local_to_gmt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了local_to_gmt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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);
 }
开发者ID:newbeess,项目名称:razor,代码行数:26,代码来源:pageviewmodel.php

示例2: addFaq

 function addFaq()
 {
     //Intialize values for library and helpers
     $this->form_validation->set_error_delimiters($this->config->item('field_error_start_tag'), $this->config->item('field_error_end_tag'));
     if ($this->input->post('addFaq')) {
         //Set rules
         $this->form_validation->set_rules('question', 'Question', 'required|trim|xss_clean');
         $this->form_validation->set_rules('faq_content', 'Answer', 'required|trim');
         if ($this->form_validation->run()) {
             //prepare insert data
             $insertData = array();
             $insertData['question'] = $this->input->post('question');
             $insertData['faq_content'] = $this->input->post('faq_content', false);
             $insertData['created'] = local_to_gmt();
             //Add Groups
             $this->faq_model->addfaq($insertData);
             //Notification message
             $this->session->set_flashdata('flash_message', $this->Common_model->admin_flash_message('success', translate_admin('FAQ added successfully')));
             redirect_admin('faq/viewFaqs');
         }
     }
     //If - Form Submission End
     //Load View
     $data['message_element'] = 'administrator/faq/addFaq';
     $this->load->view('administrator/admin_template', $data);
 }
开发者ID:BersnardC,项目名称:DROPINN,代码行数:26,代码来源:faq.php

示例3: mobileCode

 public function mobileCode()
 {
     $post = $this->input->post();
     $mobile = $post['mobile'];
     $this->load->helper('string');
     $this->load->model('sms');
     $this->load->model('validation');
     if (!preg_mobile($mobile)) {
         echo json_encode(array('code' => '1002', 'msg' => '错误的手机号码'));
         exit;
     }
     $code = mt_rand(100000, 999999);
     $msg = "您好!您验证手机号所需的验证码为" . $code . ",请勿泄露给任何人,30分钟内有效。";
     if ($this->sms->send($mobile, $msg)) {
         $this->validation->delete_by(array('mobile' => $mobile));
         if ($this->validation->insert(array('mobile' => $mobile, 'code' => $code, 'expires' => local_to_gmt() + 1800))) {
             echo json_encode(array('code' => '1000'));
             exit;
         }
     } else {
         echo json_encode(array('code' => '1002', 'msg' => '发送失败,请稍候重试'));
         exit;
     }
     echo json_encode(array('code' => '1001', 'msg' => '发生错误'));
 }
开发者ID:norain2050,项目名称:one,代码行数:25,代码来源:send.php

示例4: addAdmin_key

 /**
  * Loads Add Admin key.
  *
  * @access	private
  * @param	nil
  * @return	void
  */
 public function addAdmin_key()
 {
     //Intialize values for library and helpers
     $this->form_validation->set_error_delimiters($this->config->item('field_error_start_tag'), $this->config->item('field_error_end_tag'));
     if ($this->input->post('addAdmin_key')) {
         //Set rules
         $this->form_validation->set_rules('Admin_key', 'Page_key', 'required|trim|xss_clean');
         //$this->form_validation->set_rules('page_ref.','page_ref.','required|trim|xss_clean');
         if ($this->form_validation->run()) {
             //prepare insert data
             $insertData = array();
             $insertData['page_key'] = $this->input->post('Admin_key');
             $insertData['page_refer'] = $this->input->post('page_ref');
             $insertData['status'] = $this->input->post('is_footer');
             $insertData['created'] = local_to_gmt();
             if ($this->Common_model->getTableData('admin_key', array('status' => 0))->num_rows() == 0 && $insertData['status'] == 0) {
                 //Add Groups
                 $this->Admin_key_model->addAdmin_key($insertData);
                 //Notification message
                 $this->session->set_flashdata('flash_message', $this->Common_model->admin_flash_message('success', translate_admin('Admin Key added successfully')));
             } else {
                 $this->session->set_flashdata('flash_message', $this->Common_model->admin_flash_message('error', translate_admin('Sorry! Already another Admin Key in active state.')));
             }
             redirect_admin('admin_key/viewAdmin_key');
         }
     }
     //If - Form Submission End
     //Get Faq Categories
     $data['Admin_key'] = $this->Admin_key_model->getAdmin_keys();
     $data['message_element'] = "administrator/admin_key/addAdmin_key";
     $this->load->view('administrator/admin_template', $data);
 }
开发者ID:BersnardC,项目名称:DROPINN,代码行数:39,代码来源:admin_key.php

示例5: 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;
 }
开发者ID:stdroom,项目名称:MKAnalytics,代码行数:34,代码来源:transratemodel.php

示例6: 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);
}
开发者ID:gitanton,项目名称:cono-rest,代码行数:7,代码来源:MY_date_helper.php

示例7: index

 public function index()
 {
     $data = array();
     $show_count = 3;
     //首页展示楼层数量
     $this->load->model('user');
     $this->load->model('product');
     $this->load->model('product_category');
     $this->load->model('product_category_map');
     $this->load->model('newss');
     $this->load->model('link');
     $this->load->model('product_brand');
     $this->load->model('ad');
     $this->load->model('order');
     $this->load->model('coupon');
     $product_cate = $this->product_category->get_level_tree();
     //树状产品类型
     /*	
     		if($product_cate){
     			foreach ($product_cate as $key => $item) {
     				$cate_id_ary = $this->product_category->get_all_children($item['id']);
     				$ids = array($item['id']);
     				foreach ($cate_id_ary as $k => $v) {
     					$ids[] = $v;
     				}
     
     				$hot_product = $this->product_category_map->get_product_by_cate($ids);	//首页展示的商品
     				$brand = $this->product_brand->get_by_cateid($item['id']); 				//首页商品区展示的品牌
     				$product_cate[$key]['hot_product'] = $hot_product;
     				// $product_cate[$key]['product_cate_brand'] = $brand;
     				if($key == ($show_count-1))	//只展示前三楼
     					break;
     			}
     		}
     */
     //$handpick_product = $this->product->lists(8,'','',array('handpick = 1'));
     //$data['handpick_product'] = $handpick_product;
     $data['show_count'] = $show_count;
     $data['product_cate'] = $product_cate;
     $data['news'] = $this->newss->lists(array("status='1' or (status='2' and show_time < " . local_to_gmt() . ")", "cate_id='1'"), 5, "a.show_time desc");
     //按发布时间
     $data['vip_news'] = $this->newss->lists(array("status='1' or (status='2' and show_time < " . local_to_gmt() . ")", "cate_id='2'"), 5, "a.show_time desc");
     //按发布时间
     $data['link'] = $this->link->lists(array("num" => "5"));
     //最新五条友情链接
     $data['ad_home'] = $this->ad->lists(array("where" => "position_id = 1"));
     //首页广告
     //$data['ad_1F'] = $this->ad->lists(array("where"=>"position_id = 2"));//1L广告
     //$data['ad_2F'] = $this->ad->lists(array("where"=>"position_id = 3"));//2L广告
     //$data['ad_3F'] = $this->ad->lists(array("where"=>"position_id = 4"));//3L广告
     $data['product_brand'] = $this->product_brand->lists(array("num" => "10"));
     //最新27条品牌信息
     $data['coupon'] = $this->coupon->lists(array("expirse_from < " . local_to_gmt(), "expirse_to > " . local_to_gmt()), 5, "a.id desc");
     if ($this->auth->is_login()) {
         $data['order_count'] = $this->order->user_count(array('user_id' => $this->auth->user_id()));
         $user = $this->user->get($this->auth->user_id());
         $data['score'] = $user->score;
     }
     $this->load->view('home/index', $data);
 }
开发者ID:norain2050,项目名称:one,代码行数:60,代码来源:index.php

示例8: get_gmt_time

 function get_gmt_time($time = '')
 {
     if ($time == '') {
         $time = time();
     }
     $gmt = local_to_gmt($time);
     return $gmt;
 }
开发者ID:BersnardC,项目名称:DROPINN,代码行数:8,代码来源:MY_date_helper.php

示例9: 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;
 }
开发者ID:khanals,项目名称:rbs-ext,代码行数:9,代码来源:MY_date_helper.php

示例10: insert

 public function insert($row)
 {
     if (is_array($row) && !empty($row)) {
         if (!isset($row['create_time']) || $row['create_time'] == '') {
             $row['create_time'] = local_to_gmt();
         }
         if ($this->db->insert($this->table, $row)) {
             return $this->db->insert_id();
         }
     }
     return false;
 }
开发者ID:norain2050,项目名称:one,代码行数:12,代码来源:ad.php

示例11: insert

 public function insert($row)
 {
     if (is_array($row) && !empty($row)) {
         if (!isset($row['create_time']) || intval($row['create_time']) <= 0) {
             $row['create_time'] = local_to_gmt();
         }
         if (!isset($row['expires']) || intval($row['expires']) <= 0) {
             $row['expires'] = $row['create_time'] + 24 * 3600;
         }
         if ($this->db->insert($this->table, $row)) {
             return $this->db->insert_id();
         }
     }
     return false;
 }
开发者ID:norain2050,项目名称:one,代码行数:15,代码来源:validation.php

示例12: getOnlineUsers

 function getOnlineUsers($productId)
 {
     $timezonestimestamp = gmt_to_local(local_to_gmt(), $this->config->item('timezones'));
     $timezonestime = date('Y-m-d H:i:m', $timezonestimestamp);
     $ret = array();
     for ($i = 30; $i >= 0; $i--) {
         $dataStr = date('Y-m-d-H-i', strtotime("-{$i} minutes", strtotime($timezonestime)));
         $size = $this->redis->hlen("razor_r_u_p_" . $productId . "_" . $dataStr);
         if ($i == 0) {
             $onlinedata = array('minutes' => lang("v_rpt_realtime_now"), 'size' => $size);
         } else {
             $onlinedata = array('minutes' => "- " . $i . lang("v_rpt_realtime_minutes"), 'size' => $size);
         }
         array_push($ret, $onlinedata);
     }
     return $ret;
 }
开发者ID:newbeess,项目名称:razor,代码行数:17,代码来源:onlineusermodel.php

示例13: insert

 public function insert($row)
 {
     if (is_array($row) && !empty($row)) {
         if (!isset($row['create_time']) || intval($row['create_time']) == 0) {
             $row['create_time'] = local_to_gmt();
         }
         if (!isset($row['user_id']) || intval($row['user_id']) == 0) {
             $row['user_id'] = $this->auth->is_login() ? $this->auth->user_id() : 0;
         }
         if (!isset($row['status'])) {
             $row['status'] = 1;
         }
         if ($this->db->insert($this->table, $row)) {
             return $this->db->insert_id();
         }
     }
     return false;
 }
开发者ID:norain2050,项目名称:one,代码行数:18,代码来源:pay_log.php

示例14: insert

 public function insert($row)
 {
     if (is_array($row) && !empty($row)) {
         if (!isset($row['user_id'])) {
             $row['user_id'] = $this->auth->user_id();
         }
         if (!isset($row['username'])) {
             $row['username'] = $this->auth->username();
         }
         if (!isset($row['time'])) {
             $row['time'] = local_to_gmt();
         }
         if (!isset($row['ip'])) {
             $row['ip'] = $this->input->ip_address();
         }
         if ($this->db->insert($this->table, $row)) {
             return $this->db->insert_id();
         }
     }
     return false;
 }
开发者ID:norain2050,项目名称:one,代码行数:21,代码来源:logs.php

示例15: test

 function test()
 {
     ini_set('date.timezone', 'PRC');
     //people republic of china
     $this->load->helper("date");
     //  echo timezone_menu("UP8");
     // $datestring = "Year: %Y Month: %m Day: %d - %h:%i %a";
     $time = time();
     // echo standard_date("DATE_ATOM", $time);
     $timestamp = local_to_gmt($time);
     //转化为时间戳 gmt greenwich mean time 格林尼治时间
     //$timezone="PRC";//people republic of china
     //  echo gmt_to_local($timestamp,$timezone,true);
     $mysql = '20061124092345';
     $unix = mysql_to_unix($mysql);
     $past_time = '19900926092633';
     $a = strtotime($past_time);
     echo local_to_gmt($past_time);
     // $time=time();
     echo timespan($past_time, $time);
     ///$past_time 一定是个时间戳
 }
开发者ID:GStepOne,项目名称:CI,代码行数:22,代码来源:time.php


注:本文中的local_to_gmt函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。