Hi everyone,
Has anyone else encountered the problem where valueOf on a date/time in milliseconds does not return consistent values?
i.e. I quite extensively have to calculate the number of days between two dates,
so I would use something like:
date1 = util.scand("mm/dd/yyyy" + "HH:MM:ss", month+"/"+day+"/"+year + "00:00:00");
var dateVal = date1.valueOf();
Now if I print out the value of dateVal with the same input, it is not always the same value. I have stipulated the minutes, seconds and hours to always get midnight on the day in question, but it still does not return the same value.
Is this because of milliseconds as well, and if so, how is it deciding that value?
This makes it complicated when comparing dates, for example, when subtracting one date from another I can't just say if date1 is less than date 2 - because it may not be less, but still actually be one day behind..
if that makes sense? :)
George Kaiser