PHP: How to calculate the difference between two given dates

0   0
Nitin Sharma
profile rohan 17th March 2026

Simple gameplay mechanics make this app easy to enjoy for players of all ages. The straightforward design helps users start quickly without confusion.  in999 club  Online gamers can enjoy entertaining games and exciting rewards through a smooth and accessible gaming platform.

profile rohan 17th March 2026

This gaming app is perfect for relaxing while still feeling competitive. Fast paced online games keep players entertained and engaged. bdg win login The rewards system adds extra excitement, making each session enjoyable for users who love fun and challenging gameplay.

profile rohan 17th March 2026

Instant rewards add excitement and motivation to every game played on this platform. Players feel encouraged to continue gaming while enjoying real earning opportunities.  in999 game login  The smooth system and quick results make daily online gaming sessions fun, engaging, and rewarding.

profile Slope 2nd March 2026

Use PHP’s DateTime::diff() method for an accurate and reliable way to calculate the difference between two dates — clean and efficient Slope Rider coding.

profile Erik 12th February 2026

I love how you broke down the process of calculating date differences! I recently used a similar method for planning my pet's birthday surprise—time really flies. Do you have any tips for using this in everyday life? animal craft

profile Harry 7th February 2026

Geometry Dash PC tests player reflexes by demanding precise jumps, quick reactions, and perfect rhythm synchronization.

profile saahil 30th January 2026

Your time is precious. By removing doubt, our Escorts Gurgaon honors that. We guarantee that you can swiftly locate a respectable, attractive skilled mate without having to go through dubious choices thanks to our precise, enticing listings and simple booking process. Our foundational values are excellence and efficacy.

profile Amora 28th January 2026

The way that music and movement interact is what really makes Geometry Dash Lite unique. By picking up the beat and timing your movements to each rise and fall, you are performing the game rather than merely playing it.

profile Ranjeet 8th November 2016
<?php
 
 
 
$startdate = "20016-03-24"; //date1
$enddate = "20016-06-27"; //date2
 
$difference  = abs(strtotime($enddate) - strtotime($startdate));
 
$years = floor($difference / (365*60*60*24));
$months = floor(($difference - $years * 365*60*60*24) / (30*60*60*24));
$days = floor(($difference - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
 
printf("%d years, %d months, %d days\n", $years, $months, $days);
?>

Please rotate your device

We don't support landscape mode on your device. Please rotate to portrait mode for the best view of our site