Difference between two dates
Input String: calculateDays(“01-01-2014″,”12-12-2014”)
Date Format: MM-DD-YYYY
function calculateDays(datetime1, datetime2) {
var oneDay = 1000 * 60 * 60 * 24; // The number of milliseconds in a day
//Convert the datetime1 and datetime2 to Date object and get Time in milliseconds
var dt1 = new Date(datetime1).getTime();
var dt2 = new Date(datetime2).getTime();
// Calculate the difference in milliseconds
var diff = Math.abs(dt1- dt2); // Difference of Days
return Math.round(diff / oneDay);
}
Keep this going please, great job!
LikeLike
Thank you
LikeLike
Thanks for the great post!
LikeLike
Thank you Ola Abke 🙂
LikeLike
Great info!
LikeLike
Top notch blog post.Thanx just for penning this useful article in addition to enlightening us all with the feelings.I’m hoping you are going to proceed this great work at a later date as well.
LikeLike
Nice post. I learn something totally new and challenging on sites I stumbleupon every day.
It’s always exciting to read content from other writers and use something from other websites.
LikeLike
“Great Blogpost! Hi there! This is my first comment here so I just wanted to give a quick shout out_ and tell you I genuinely enjoy reading through your posts. Can you recommend any other blogs/websites/forums that deal with the same topics?”
LikeLike
“Great Blogpost! Hi there! This is my first comment here so I just wanted to give a quick shout out_ and tell you I genuinely enjoy reading through your posts. Can you recommend any other blogs/websites/forums that deal with the same topics?”
LikeLike