SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Jul 2002
    Location
    Sooner Nation
    Posts
    208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Calculating time difference

    I can't seem to find the way to calculate time. I have military time in the input boxes. All I need to do is take time out (say 18:00) and subtract it from time in (say 08:00).

    eval(out - in) wont work. How do I let JS know this is a time I want to see the difference of?
    The only function of business is to create customer value and to innovate. - Peter Drucker

  2. #2
    Caveat surfer Buddy Bradley's Avatar
    Join Date
    May 2003
    Location
    Cambridge, UK
    Posts
    2,366
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    var start_time = new Date().getTime();
    doSomething();
    var end_time = new Date().getTime();
    alert ("That took " + (end_time - start_time) + " milliseconds!");


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •