Search
 
SCRIPT & CODE EXAMPLE
 

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;
Comment

PREVIOUS NEXT
Code Example
Php :: laravel factory get foreign key 
Php :: if condition in smarty 
Php :: php has constant 
Php :: php keep only digitts 
Php :: laravel order by numbers 
Php :: php read text file into array 
Php :: codeigniter 3 update 
Php :: laravel 8 eloquent orderby 
Php :: php number format comma and decimal 
Php :: remove a specific element from an array php 
Php :: uppercase php 
Php :: php rsort retain keys 
Php :: how to fetch all column values php 
Php :: check if not empty blade engine 
Php :: how to start composer in laravel project on localhost 
Php :: compare dates datetime php 
Php :: string compare in php 
Php :: searchable dropdown laravel blade 
Php :: Day of Week Using carbon library 
Php :: php unserialize array 
Php :: can we create linked list in php 
Php :: php match 
Php :: woocommerce get orders by user id 
Php :: ckeditor laravel 
Php :: php gethostname 
Php :: setup cron on macos for laravel 
Php :: php use function from same class 
Php :: display image from mysqli database 
Php :: phpspreadsheet CellProtection 
Php :: magento 2 db connection 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =