aspose file tools*
The moose likes JDBC and the fly likes How to calculate difference between two dates in months Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to calculate difference between two dates in months" Watch "How to calculate difference between two dates in months" New topic
Author

How to calculate difference between two dates in months

Sudarshan Reddy
Greenhorn

Joined: Aug 23, 2007
Posts: 20
Hi
can any one tell how to calculate difference between two dates in months?


With Regards<br /> <br />Sudarshan Reddy
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Depends on the DB used. Just consult the SQL documentation which comes along it. If you're using for example MySQL, you can use the DATEDIFF function for this.
Sudarshan Reddy
Greenhorn

Joined: Aug 23, 2007
Posts: 20
i am using the mysql DB

datediff function getting difference in dates but i need in months between two dates..?
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Use TIMESTAMPDIFF.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to calculate difference between two dates in months