I have two variables. weekStartDate and startDate. they both hold essentially the same timestamp:
this.startDate Date {Mon Mar 26 2012 00:00:00 GMT+0530 (IST)}
this.weekStartDate Date {Mon Mar 26 2012 00:00:00 GMT+0530 (IST)}
the problem is: when I try to getTime(), they show a slightly different value:
this.startDate.getTime() 1332700200000
this.weekStartDate.getTime() 1332700200506
how can i fix this?
The difference is 506 milliseconds. The number of milliseconds isn’t displayed when you call
toString()on aDateobject, so anything more precise than seconds will go unnoticed unless you compare the numeric value.To reset the milliseconds to
0, use: