12,820,108 members (23,279 online)
Rate this:
See more:
Hi friends...

i am using jquery plugin for datepicker.

in this i get month/day/year format

so i have 2 text feild for dates

Ex:

textfeild1: 09/24/2012

textfeild1: 12/25/2012

then i want to find out no of months between these 2 dates

plz help me... for this i am frustating from more days

Thanks & Regards

Mallesh(emailid deleted)
Posted 15-Jan-13 2:15am
Updated 15-Jan-13 2:34am
v2
AshishChaudha 15-Jan-13 7:29am

Sandeep Mewara 15-Jan-13 13:49pm

Why, where are you stuck?

Rate this:

## Solution 3

```//Set the two dates
var currentTime   = new Date()
var currDate      = currentTime.getMonth() + 1 + "/" + currentTime.getDate() + "/" + currentTime.getFullYear() //Todays Date - implement your own date here.
var iniPastedDate = "8/7/2012" //Pasted Date - Implement your own date here.

//currDate = 8/17/12 and iniPastedDate = 8/7/12

function DateDiff(date1, date2) {
var datediff = date1.getTime() - date2.getTime(); //store the getTime diff - or +
return (datediff / (24*60*60*1000)); //Convert values to -/+ days and return value
}

//Write out the returning value should be using this example equal -10 which means
//it has pasted by ten days. If its positive the date is coming +10.
document.write (DateDiff(new Date(iniPastedDate),new Date(currDate))); //Print the results...
```

The only thing you have to do from this answer is to get the month diff value.
Rate this:

## Solution 2

v2
Marcus Kramer 15-Jan-13 11:48am

The OP is asking for a javascript solution.

Top Experts
Last 24hrsThis month
 OriginalGriff 240 ppolymorphe 55 Peter Leow 45 Richard MacCutchan 40 CPallini 40
 OriginalGriff 4,757 Graeme_Grant 3,814 Karthik Bangalore 3,501 Jochen Arndt 2,571 ppolymorphe 2,497