Sometime there is a need to perform different operation on dates for ex:
You may need to :
1) Add two dates/time
2) Subtract two dates/times for ex- to calculate your age by deducting your date of birth from current date.
And many more.
You can do this following:
$requested_time = 02:40:00;
$currentTime = strtotime(date( 'H:i:s') ); // Converts the current time into unix timestamp.
$inTime = strtotime($$requested_time); // Convert the req. time into unix timestamp.
Echo $newTime = $currentTime - $inTime;
0 Comment(s)