Skip to content

Instantly share code, notes, and snippets.

@manigandanta
Created May 18, 2012 04:38
Show Gist options
  • Save manigandanta/2723171 to your computer and use it in GitHub Desktop.
Save manigandanta/2723171 to your computer and use it in GitHub Desktop.
difference b/w two dates
<?php
$date1 = $date;
$date2 = date("Y-m-d");
$diff = abs(strtotime($date2) - strtotime($date1));
//$years = floor($diff / (365*60*60*24));
$months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
//$days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment