Hi,
New to AppGini and PHP I need to calculate the total time for an event.
I have a start time (time field) and completion time (time field).
In the before update hook I have the following formula:
$data['TotalTime'] = $data['CompletionTime'] - $data['StartTime'];
This always gives the result -12:00:20A.
Guidance appreciated.
John
Calculating time difference
Re: Calculating time difference
Try: This should work assuming both times (start and completion) are in the same day.
Code: Select all
$diff_seconds = strtotime($data['CompletionTime']) - strtotime($data['StartTime']);
$data['TotalTime'] = gmdate("H:i:s", $diff_seconds);

- DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
- Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.
- Need personalized consulting on your specific app and customizations? Book an online call with me here.
Re: Calculating time difference
thanks for the code a.gneady.
very much appreciated.
very much appreciated.
Re: Calculating time difference
You're always welcomedallo wrote:very much appreciated.


- DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
- Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.
- Need personalized consulting on your specific app and customizations? Book an online call with me here.