iPixel Posted December 21, 2009 Share Posted December 21, 2009 Is there a function i can use to figure out how many days are between certain dates, liek strtotime() or something? I get dates passed like 15-DEC-2009 & 18-DEC-2009 so there's 3 days between those 2 dates. Any idea how? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/185929-how-many-days-between-dates/ Share on other sites More sharing options...
iPixel Posted December 21, 2009 Author Share Posted December 21, 2009 This seems to work. $days = ((strtotime($tempED) - strtotime($tempSD)) / (60 * 60 * 24))+1; echo $days; Quote Link to comment https://forums.phpfreaks.com/topic/185929-how-many-days-between-dates/#findComment-981841 Share on other sites More sharing options...
salathe Posted December 21, 2009 Share Posted December 21, 2009 If you're using PHP 5.3, date_diff otherwise let us know what version you do have and answers can be more tailored towards that. Quote Link to comment https://forums.phpfreaks.com/topic/185929-how-many-days-between-dates/#findComment-981843 Share on other sites More sharing options...
roopurt18 Posted December 21, 2009 Share Posted December 21, 2009 This thread may be helpful: http://www.phpfreaks.com/forums/index.php/topic,277182.msg1310876.html#msg1310876 Quote Link to comment https://forums.phpfreaks.com/topic/185929-how-many-days-between-dates/#findComment-981846 Share on other sites More sharing options...
iPixel Posted December 21, 2009 Author Share Posted December 21, 2009 PHP Version 5.2.9-2 Quote Link to comment https://forums.phpfreaks.com/topic/185929-how-many-days-between-dates/#findComment-981855 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.