Page 1 of 1

Difference between two times

Posted: 2016-05-08 10:14
by ucevista
Hi everybody.

I have a form made with Appgini and I have three time fields with format time. In the two first fields I input the start and end time and the third one has to have the difference between the two firsts fields.

For this I use the table_after_insert and table_after_update hooks into the table_dml.php. The formula I used is:

$data['difference'] = $data['end'] - $data['start'];

The line is executed but the result is incorrect. For example, if the inputs are 13:00 for start and 17:00 for the end the result obtained is 00:00:04. 4 is correct but it is shown as seconds and not as hours.

I have made my own data format for 24 hours time but the result is the same with any other format used.

What may be happening?

Thanks a lot for your replays.

Re: Difference between two times

Posted: 2016-05-08 20:12
by AhmedBR
Try Subtime function mysql, take a look at this topic:

http://forums.appgini.com/phpbb/viewtop ... ence#p4655