Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Time Different Find in Two Dates
- $datetime1 = new DateTime();
- $datetime2 = new DateTime('2021-06-10 04:06:06');
- $interval = $datetime1->diff($datetime2);
- $elapsed = $interval->format('%y years %m months %a days %h hours %i minutes %s seconds');
- echo $elapsed;
- //Time Different Find in Two Dates For Minutes Only
- $time = new DateTime("2021-06-10 04:06:06");
- $diff = $time->diff(new DateTime());
- $minutes = ($diff->days * 24 * 60) +
- ($diff->h * 60) + $diff->i;
- echo "<br>".$minutes;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement