Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

calculate total time from start and end datetime in php

date1 = new DateTime('2006-04-12T12:30:00');
$date2 = new DateTime('2006-04-14T11:30:00');

$diff = $date2->diff($date1);

$hours = $diff->h;
$hours = $hours + ($diff->days*24);

echo $hours;
 
PREVIOUS NEXT
Tagged: #calculate #total #time #start #datetime #php
ADD COMMENT
Topic
Name
8+9 =