1
I have two datetime fields and would like to know the difference between them. I am developing in Php Gtk, so the functions have to be as low as possible.
1
I have two datetime fields and would like to know the difference between them. I am developing in Php Gtk, so the functions have to be as low as possible.
0
One of the ways to do this oriented to objects, is using the class Datetime, it has the diff method that returns a Dateinterval object, which represents the interval between two distinct dates:
Following the example of dates:
$data1 = new DateTime( '2013-12-11' );
$data2 = new DateTime( '1994-04-17' );
$intervalo = $data1->diff( $data2 );
echo "Intervalo é de {$intervalo->y} anos, {$intervalo->m} meses e {$intervalo->d} dias";
Browser other questions tagged php
You are not signed in. Login or sign up in order to post.
That answers? How to calculate the difference between two dates?
– rray
My dear friend, see if this can help you Link: http://answall.com/questions/57/howto calculate a difference%C3%A7a-between-two-dates
– Elliot Alderson