Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

how to calculate days difference between two dates in php

// how to calculate days difference between two dates in laravel

use DateTime; // inside Controller Class

$startDate = new DateTime($request->start_date);
$endDate   = new DateTime($request->end_date);

$daysDifference = ($startDate->diff($endDate)->days);
 
PREVIOUS NEXT
Tagged: #calculate #days #difference #dates #php
ADD COMMENT
Topic
Name
6+9 =