开发者

Want to get the number of months through JavaScript

I want to get the number of months between two dates with JavaScript, but if the number of days greater than 30 days or greater than 1 month then it directly return me two months.

For example if my from date is 17/01/2011 and to 开发者_开发问答date is 20/02/2011 then my function returns two months because then days between two days exceeds one month.

Hope you all understand.


I recommend Mootools Date.diff. If you're tied to jQuery, you could instead refer to this post on Stack Overflow.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜