I have a situation where I use the php gmdate () function in two different codeigniter controllers. Controllers return a 6-hour difference with exactly the same calls.
Below is a controller that returns the correct GMT date and below, which is at a distance of 6 hours. Hope this is just something on my part. Thanks in advance for any help.
public function update_current_user($session_id){
$this->load->helper('date');
$this->load->helper('url');
$currentURL = base_url().uri_string();
$updateData = array(
'id'=>$session_id ,
'last_updated'=>gmdate("Y-m-d H:i:s",time()),
'current_url'=> $currentURL
);
$this->db->where('id',$session_id);
$this->db->update('current_visitors', $updateData);
return true;
}
Below is the one where he returns for 6 hours.
public function initiate_chat($id,$name)
{
$this->load->helper('date');
$this->load->helper('url');
$currentURL = base_url().uri_string();
$updateData = array(
'id'=>$id ,
'last_updated'=>gmdate("Y-m-d H:i:s",time()),
'chat_requested_time'=>gmdate("Y-m-d H:i:s",time()),
'requested_chat'=>1,
'name'=>$name,
);
$this->db->where('id',$id);
$this->db->update('current_visitors', $updateData);
return $name;
}
source
share