Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Get Number of Months From two Dates using Javascript

 
Sreenivas Reddy Tatikunta
Greenhorn
Posts: 24
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,


I have following dates in javascript,

var date1 = 05-30-2011
var date2= 08-23-2011(Current Date)

It should compare both dates and return number months. This example result is 2 months 23 days (Here days not required only should return exact months). Using javascript.

If anyone have idea could you please help me...


Thanks & Regards
Sreenivas Reddy.T
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like you need:

  • new Date()
  • getFullYear()
  • getMonth()


  • Eric
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic