podarum Posted July 25, 2009 Report 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 Report 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
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now