![]() |
How to work with timestampdiff? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: How to work with timestampdiff? (/showthread.php?tid=73628) |
How to work with timestampdiff? - rjay - 05-15-2019 Hi Friends, Good Day! I would like to ask some help in working with timestampdiff. I wanted to get the time duration between the datastarted and dateresolved. and the result will be automatically inserted into the database. Below is my Report_Model Codes. Code: function get_TimeDifference($id) Code: function update_downtime($id) Please see highlighted codes Thank you and best regards, Jay RE: How to work with timestampdiff? - php_rocs - 05-15-2019 @rjay, ...or as a suggestion. You could obtain the start and solution timestamps. Store them in the database and then use a database view to give you the difference. Basically, using the database to do the heavy lifting of figuring out the time difference. RE: How to work with timestampdiff? - rjay - 05-15-2019 Hi @php_rocs, I don't get the logic what I wanted is. I have the value of the DateStarted once I have inputted the value of DateResolved it will automatically get the timestampdiff or the outage duration and will insert the Outage duration into the database. RE: How to work with timestampdiff? - php_rocs - 05-15-2019 @rjay, I'm saying first get both timestamp values into the database. Then all you have to do is create a database view that will take those two values and give you the difference (in a timestamp format). Pass that view to your controller which will pass it to your view. Then there will be no need to save the difference value in the database. RE: How to work with timestampdiff? - InsiteFX - 05-16-2019 MySQL Tutorial Views MySQL Views RE: How to work with timestampdiff? - rjay - 05-20-2019 Hi Everyone, Thanks for helping me out , Create a view on mysql did solve my problem |