DEMO of difference in date and time

Calculate a user-entered date/time difference

Parse both inputs and use DateTimeInterface::diff() for a calendar-aware interval.

$start = new DateTimeImmutable('2026-09-14 09:00');
$end = new DateTimeImmutable('2026-09-16 17:30');
$interval = $start->diff($end);
echo $interval->format('%a days %h hours %i minutes');

Current example first; the detailed examples and demos below are retained for additional learning and comparison.

Enter all data

Hr

Min

Sec

Hr

Min

Sec





Subscribe to our YouTube Channel here



plus2net.com











PHP video Tutorials
✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer