Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6165093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:06:24+00:00 2026-05-23T22:06:24+00:00

the 1 st one which get using the id has format var checkindate =

  • 0

the 1 st one which get using the id has format

var checkindate = $('#check-in').text();

28-07-2011

then i get the current date using

var now = new Date();

and it has the format

Wed Jul 20 2011 19:09:46 GMT+0530 (IST)

i want to get the date difference from these two dates . in this case it is 8
. i searched a lot and could not find an answer , please help……. :'(

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T22:06:25+00:00Added an answer on May 23, 2026 at 10:06 pm

    You can parse the initial date, feed it to a date object, substract it with the current time to get a millisecond difference, and then divide it by the number of milliseconds in a day.

    var checkindatestr = "28-07-2011";
    var dateParts = checkindatestr.split("-");
    
    var checkindate = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]);
    var now = new Date();
    var difference = now - checkindate;
    var days = difference / (1000*60*60*24);
    
    alert(days);
    

    At the time of writing this gives -7.5. It’s a negative number because the date is in the future. If you want a positive number, just swap the variables in the substraction. If you want a round number, just use Math.round.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What's the difference when using GET or POST method? Which one is more secure?
How would one get columns information on table which he doesn't own, but has
I work on a app which has only one way to get a working
Say, I have a variable rv which has some numerical value. Now, I want
I'm currently using Extension:Push to copy articles from one MediaWiki (1.16) installation (which sits
I'm developing a solution which uses an ActiveX control (a commercial one which we
When a folder in the Eclipse Package Explorer (one which is linked to a
I'm writing this question with reference to this one which I wrote yesterday. After
As I understand the standard, a trivial destructor is one which is implicitly declared
I realise that this is a very basic question, but it is one which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.