If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Javascript date calculation

I'm not a Javascript guru and would appreciate some help. Basically, I'm taking the difference between two dates and then displaying the numbers of weeks with a remainder. If the first remainder decimal is 7 or greater, they want the number rounded up to the next whole number. If it's a whole number, just tack on a ".0" for consistency. I've tried the following, but it doesn't seem to work. Can anybody help or is there a cleaner way to do it?

Date.parse does not return a Date object, localized to the user, but a genuine timestamp.
The number of milliseconds between January 1, 1970 at 12:00:00 (AM) in Greenwich, England and the date you are parsing.

This is like the return from a Date object's getTime() method- and why there is no need for getUTCTime.

As long as you do not force a local Date object, there is no daylight savings time, and each day has 24 hours.

Great folks - thanks for everything. I guess I really won't have to worry about too much - it's never going to be more than 40-45 weeks because the dates being calculated are gestation weeks for pregnancy.

But, back to the main question. They want me to round up to the next whole number anything greater than or equal to .7 in the remainer. I know how to do that on the asp.net side, but I'm not really good at JavaScript and having trouble on that side. Any help there? I'd really appreciate it.

Thanks so much for your reply - I appreciate it. Problem is, that's not what they want. If I simply add three tenths, the number itself changes. They literally want me to evaluate the tenth to see if it's greater than or equal to 7 and only then increment it to the next whole number and tack on a ".0". Since I'm not very good at JavaScript, I can't tell if my problem is with evaluating to see if the tenth is greater than or equal to 7, or trying to increment the number.