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 6599173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:27:21+00:00 2026-05-25T18:27:21+00:00

i use two datepickers to get the arrival and the departure date, counting the

  • 0

i use two datepickers to get the arrival and the departure date, counting the days for the number of nights, all is working nice, except one thing: if i take my startdate on 29.10.2011 and my enddate on the 31.10.2011 jquery counts 3 nights but there only 2 nights. Only in october, other month still working fine, hope someone could help me to figure out where my mistake is:

var oneDay = 1000*60*60*24; 
var difference = Math.ceil((arrivalDate.getTime() - departureDate.getTime()) / oneDay); 
  • 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-25T18:27:21+00:00Added an answer on May 25, 2026 at 6:27 pm

    The problem is that daylight saving time ends on 30th October in Europe (where, going by the German error message, you are). As a result, where there would normally be 24+24+24=72 hours between the dates, in this case, there are 24+24+24+1=73 hours between the dates. Your code therefore works out that there are 2.041666 days between the dates. Your Math.ceil then rounds this up to 3.

    The simplest solution to this in this case is probably just to replace Math.ceil with Math.round. When DST ends, your 2.04166 days will be rounded to 2 days. When DST starts, the 1.95834 days you’ll work out then will also be rounded to 2 days.

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

Sidebar

Related Questions

I want to use two external jars from EJB: jar #1 - all interfaces
I have two datepickers at the moment, one for a start date, and another
I use two Spinner in my App. One of them is initially disabled because
i use two blocks to draw some buttons on my subview dynamically. One calculates
Can you use two regex in preg_replace to match and replace items in an
I want to use two meta:resourcekey in single control is it possible? for example
I need to use two extension methods SqlCommandExtensions & SqlConnectionExtensions http://msdn.microsoft.com/en-us/library/microsoft.practices.enterpriselibrary.windowsazure.transientfaulthandling.sqlazure(v=pandp.50).aspx Here they say
My script below will use two external tables to fill two separate tables, but
Here I use two images. when i click once on the Sort_down.png image then
How to use lexer rules having same starting? I am trying to use two

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.