Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

substract two datetime and get the different hours and minutes php

$time1 = new DateTime('2022-05-05 11:54:48');
$time2 = new DateTime('2022-05-05 12:00:48');
$diff = $time2->diff($time1);
$time_spent = $diff->format("%H:%I:%S");
echo $time_spent;
//Jerespy
 
PREVIOUS NEXT
Tagged: #substract #datetime #hours #minutes #php
ADD COMMENT
Topic
Name
4+1 =