Search
 
SCRIPT & CODE EXAMPLE
 

PHP

time difference between two datetime.time

# Create datetime objects for each time (a and b)
dateTimeA = datetime.datetime.combine(datetime.date.today(), a)
dateTimeB = datetime.datetime.combine(datetime.date.today(), b)
# Get the difference between datetimes (as timedelta)
dateTimeDifference = dateTimeA - dateTimeB
# Divide difference in seconds by number of seconds in hour (3600)  
dateTimeDifferenceInHours = dateTimeDifference.total_seconds() / 3600
Comment

Difference in seconds between datetime

$start = new DateTime('2011-12-31 00:00:00');
$end = new DateTime('2021-01-01 00:00:00');

echo $end->getTimestamp() - $start->getTimestamp(); // output: 284169600
Comment

PREVIOUS NEXT
Code Example
Php :: laravel on cascade set null 
Php :: laravel collection sum 
Php :: laravel validation string type 
Php :: acf get image id sub_field 
Php :: php try json decode and check 
Php :: refresh laravel model 
Php :: php random filename generator 
Php :: codeigniter 4 delete redirect with data 
Php :: laravel crud generator 
Php :: wp change num words exerpct 
Php :: wordpress enable post thumbnail 
Php :: how check the checkbox is check php 
Php :: twig log variable 
Php :: php function to remove null or 0 value from array 
Php :: laravel 6 make http request 
Php :: json encode php 
Php :: how to use custome functions in laravel 
Php :: array marge in php 
Php :: is null php 
Php :: woocommerce get shipping classes 
Php :: acf looping through post types 
Php :: laravel copy image with new name 
Php :: php try to decode json 
Php :: get shipping price of choosen shipping method woocommerce 
Php :: codeigniter sanitize input field 
Php :: comment split une chaine de caratere en php 
Php :: php base convert 
Php :: laravel manually authenticate user 
Php :: php echo html and variable 
Php :: woocommerce my account php code wordpress 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =