Friday, 6 September 2013

Date difference between dates in Javascript and datediff mysql not equal

Date difference between dates in Javascript and datediff mysql not equal

I have a javascript function that returns the number of days between two
dates, but it seems to return a day less then what mysql dateDiff function
would return
function dateDiffInDays() {
var date1 = new Date("05/30/2012");
var date2 = new Date("11/29/2013");
var diffDays = parseInt((date2 - date1) / (1000 * 60 * 60 * 24));
alert(diffDays );
}
if I use this two dates in the mysql function, i get 548, where as with
javascript, I get 547, what does mysql and excel do with their functions
thats different with javascript
(https://plus.google.com/u/0/110694602492784167520/posts)

No comments:

Post a Comment