Ninjakreborn Posted October 8, 2012 Share Posted October 8, 2012 I want to take 2 dates (first date, and second date) and determine if second date is in a different month. So if the first date is 1/2/2012 and the second date is 1/7/2012 it would return 0 as not being in a different month. But if the second date is 2/1/2012 or onward..then it would return one. Has anybody worked up a function like that on a previous project that they have had to use? Quote Link to comment https://forums.phpfreaks.com/topic/269220-determine-if-one-date-is-in-a-future-month/ Share on other sites More sharing options...
ManiacDan Posted October 8, 2012 Share Posted October 8, 2012 function isFutureMonth($one, $two) { $one = strtotime($one); $two = strtotime($two); return $one < $two && date('Y-m', $one) != date('Y-m', $two); } Quote Link to comment https://forums.phpfreaks.com/topic/269220-determine-if-one-date-is-in-a-future-month/#findComment-1383676 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.