It should not be difficult, but still I do not understand what is happening.
<?php
echo date( 'H:i', strtotime( '09:00' ) - strtotime( '08:00' ) );
echo date( 'H:i', strtotime( '18:45' ) - strtotime( '17:15' ) );
echo date( 'H:i', strtotime( '17:00' ) - strtotime( '09:00' ) );
What adds an extra hour?
Maybe I need to add a date?
<?php
echo date( 'H:i', strtotime( '22-09-2016 17:00:00' ) - strtotime( '22-09-2016 09:00:00' ) );
Additional Information
I am using Laravel en tested in Xampp.
In Laravel / config / app.php 'timezone' => 'Europe/Amsterdam',
In xampp date_default_timezone_set('Europe/Amsterdam');
Still no difference.
This calculation is done in the blade server template, where I cannot access the DateTime class.
I found a way to use the DateTime class. Another solution changed the time zone to UTC, but then all my other timestamps are wrong.
source
share