April 4th, 2013, 05:32 AM
Hello, cheers for the reply.
It probably would, but I wouldn't know how to do it, or where to begin. Ill look at the code you've kindly provided.
now you've written it, the first one seems logical, and the way to go.
sorry, perhaps i should know this, but what is - /1000/60/60/24
Really appreciate it.
Last edited by mind_grapes; April 4th, 2013 at 05:44 AM.
April 4th, 2013, 07:02 AM
The first example will work as long as the eventDate was within the current month, if you wanted to countdown to an eventDate across many months it wouldn't work too well.
The second example converts the difference between the eventDate and the current date into a time span measured in milliseconds, once we have the millisecond time difference we can then convert it back into days which is what Math.round(millisecDiff/1000/60/60/24) is doing.
In example 2 I noticed that after 12 in the afternoon the countdown changed to 12 days rather than 13 so I assume that it was being thrown off because it was taking the current time into consideration, so I've made another revision which compares the current year/month/date but not time:
Comments on this post
April 4th, 2013, 07:41 AM
Thank you once again.
I think for what I need the first is great, but it's good to know what the other code is doing, as it could be of use in the future.
Cheers to all.