podarum Posted July 25, 2009 Share Posted July 25, 2009 Hello.I have 2 dates computed from a form $date1 and $date2.. and I'd like to compute the number of months between these 2 dates.. anyone know how? thanks Link to comment Share on other sites More sharing options...
justsomeguy Posted July 27, 2009 Share Posted July 27, 2009 Either break the dates up yourself and convert them to timestamps using mktime, or you might be able to use strtotime to convert them to timestamps.http://www.php.net/manual/en/function.mktime.phphttp://www.php.net/manual/en/function.strtotime.phpOnce they're timestamps, you can just subtract one from the other. Timestamps are given in seconds, so when you subtract you'll get the difference between them in seconds. There are 86400 seconds in a day, so you can divide the difference by 86400 to get the number of days between them. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.