Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Diferencia entre dias PHP

<?php
  
  // Function to find the difference 
  // between two dates.
  function dateDiffInDays($date1, $date2) 
  {
      // Calculating the difference in timestamps
      $diff = strtotime($date2) - strtotime($date1);
  
      // 1 day = 24 hours
      // 24 * 60 * 60 = 86400 seconds
      return abs(round($diff / 86400));
  }
  
  // Start date
  $date1 = "17-09-2018";
  
  // End date
  $date2 = "31-09-2018";
  
  // Function call to find date difference
  $dateDiff = dateDiffInDays($date1, $date2);
  
  // Display the result
  printf("Difference between two dates: "
     . $dateDiff . " Days ");
?>
Comment

PREVIOUS NEXT
Code Example
Php :: laravel query foreach 
Php :: laravel collection split 
Php :: php array order alphabetically 
Php :: foreach date php 
Php :: get server ip php 
Php :: french special characters php 
Php :: php number to words 
Php :: how to redirect to another page after login in laravel 
Php :: carbon greater than 
Php :: get site url 
Php :: wordpress admin url 
Php :: php get object josn 
Php :: is replace case sensitive php 
Php :: how laravel return the old value 
Php :: how naming resource routes laravel 
Php :: insert multiple rows laravel 
Php :: how to write tests for php 
Php :: php artisan route list does not show all my routes 
Php :: merge two objects php laravel 
Php :: time zone for php is not set (configuration parameter "date.timezone"). 
Php :: $product-product_type 
Php :: wordpress how to match password 
Php :: laravel echo html 
Php :: how to upload two files on same form different path in codeigniter 
Php :: composer autoload 
Php :: laravel update email unique 
Php :: how to give optional parameter in route 
Php :: joomla get group id 
Php :: laravel relationship search 
Php :: print in file php 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =