Page 2 of 2 First 12
  • Jump to page:
    #16
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2009
    Posts
    153
    Rep Power
    5
    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.

    Kind regards
    MG
    Last edited by mind_grapes; April 4th, 2013 at 05:44 AM.
  2. #17
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    50
    Rep Power
    35
    No worries

    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:

    http://jsfiddle.net/TEaYu/2/

    Comments on this post

    • mind_grapes agrees : helped a great deal
  4. #18
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2009
    Posts
    153
    Rep Power
    5
    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.

    Regards
    MG
Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo