Why doesn't the difference between two dates give me a whole number of days

Posted by ash34 on Stack Overflow See other posts from Stack Overflow or by ash34
Published on 2010-05-02T08:19:24Z Indexed on 2010/05/02 8:27 UTC
Read the original article Hit count: 289

Filed under:

Hi,

Can someone explain this to me. From jconsole ...

from = new Date('01/01/2010')
Fri Jan 01 2010 00:00:00 GMT-0800 (PST)

thru = new Date('06/07/2010')
Mon Jun 07 2010 00:00:00 GMT-0700 (PST)

(thru - from) / (1000 * 24 * 60 * 60)
156.95833333333334

Why don't I get a whole number of days? How do I calculate the difference between two dates?

thanks much.

© Stack Overflow or respective owner

Related posts about JavaScript