Tag Archives: time

Difference between 2 time() values [closed]

Questions: I have 2 time() values, for example: 1379078542 1379078574 How do I work out their diffidence and display the output as years, months, weeks, days, hours, minutes, seconds etc. The 2 values above have a difference of 32 seconds I think, so in this case, I would want to display 32 seconds. Answers:

Codeigniter active records query taking too much time to load data from database

Questions: I’m using codeigniter This is my model <?php class groups_Model extends CI_Model { public function __construct(){ parent::__construct(); } /** * get All groups * @return array object list of groups */ public function get(){ $this->db->select(‘groups.id,groups.name as group,status.name as status’); $this->db->from(‘groups’); $this->db->join(‘status’, ‘status.id = groups.status’); $this->db->order_by(‘groups.id’, ‘ASC’); $this->db->limit($this->config->item(‘per_page’),$this->uri->segment(4)); $query = $this->db->get(); $total = $query->num_rows(); if($total… Read More »

php cookie does not work at the first time reading

Questions: I am a beginner for PHP and studying to use cookie for login. Would any body please check my code to see what is my problem, or let me how to fix this problem. When I open the page at the first time, the cookie will not work. It will work when I repeated… Read More »

PHP time intervals

Questions: I’m looking for a solution to something which seems like it should be pretty simple, but it doesn’t seem that I can find any good answers on here, and I can’t seem to get it to work myself. What I’m looking for is to set a start time, an end time, and then iterate… Read More »

How to pass time in “highcharts”?

Questions: i am passing data like this $chart->series[] = array(‘data’ => array()); in array i have data in string 1 => string ’11:03:01′ (length=8) 2 => string ’11:07:56′ (length=8) How i pass this time data in bar charts? Answers:

If DateTime Object Is Null

Questions: I am returning some search results after form submit. All is working fine, until I get to a field that is SMALLDATETIME and allows NULL. At least one of the returned rows has the field as NULL. As you can see in the code below, when it is not NULL I am converting it… Read More »

Convert the time format in php

Questions: How would I convert a date formatted like this Thu, 08 Jul 2010 15:51:01 into a date like this Thursday July 8th, 2010 3:51 pm. Also, how would I filter the first sting to not include time, so that it could look like this in the end Thursday July 8th, 2010 Answers:

How to get aggregate days from PHP's DateTime::diff?

Questions: $now = new DateTime(‘now’); $tomorrow = new DateTime(‘tomorrow’); $next_year = new DateTime(‘+1 year’); echo “<pre>”; print_r($now->diff($tomorrow)); print_r($now->diff($next_year)); echo “</pre>”; DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 10 [i] => 17 [s] => 14 [invert] => 0 [days] => 6015 ) DateInterval Object ( [y] => 1 [m]… Read More »