Это видео недоступно.
Сожалеем об этом.

JavaScript Tip: Tracking Elapsed Time

Поделиться
HTML-код
  • Опубликовано: 3 окт 2017
  • Tracking the amount of time between two events in JavaScript is not too difficult once you know a little trick with the date object. In this tutorial we will show an example of tracking the amount of time from when a page loads to the clicking of a button.
    For a complete list of all our tutorials:
    www.allthingsja...
    Take the Learn Modern JavaScript: Getting Started course at a huge discount:
    www.udemy.com/...
    Take the Learn Modern JavaScript: Advanced Topics course at a huge discount:
    www.udemy.com/...
    Here are some additional tutorials that use the date object in examples:
    • The Ins and Outs of lo...
    • Determining the Number...

Комментарии • 13

  • @jimmyfreckles4582
    @jimmyfreckles4582 Год назад

    See you soon bch

  • @creativedev3921
    @creativedev3921 3 года назад +1

    Is there any way to findout system on time in between the certain timeslot,like morning 9’o clock to evening 4’o clock

    • @AllThingsJavaScript
      @AllThingsJavaScript  3 года назад

      I'm not sure I understand what you are trying to do? How is your question different from get the time between two events?

  • @umangternate
    @umangternate 2 года назад

    Thank you for the tutorial. Can we apply it when users move to other page? I am creating a small app for training. I want it to get the initial time (entry time) and then create the exit time and send repot to backend then open the page that the user was heading to.

    • @AllThingsJavaScript
      @AllThingsJavaScript  2 года назад

      You can try the onbeforeunload event for the body tag. See if that will work for you to figure the time on page.

  • @sriharsha1150
    @sriharsha1150 4 года назад +1

    const tick = Date.now();
    const log = (v) => console.log(`${v}
    Elapsed: ${Date.now() - tick}`);
    We can just add this to find time elapsed

  • @neilfetner2427
    @neilfetner2427 4 года назад

    Can you help me develop a script where I can calculate elapsed time?

    • @AllThingsJavaScript
      @AllThingsJavaScript  4 года назад

      If you need some consulting services you can contact me at shancock@allthingsjavascript.com

  • @chchan8977
    @chchan8977 5 лет назад

    Hi can you show how to pass the elapsed time to another page and display it?

    • @divani382
      @divani382 4 года назад

      probably with document get element byid ('id of div u want the text in').ineerhtml=eclapsedtime variable

  • @dynamics
    @dynamics 4 года назад

    What theme is that? It's beautiful!

    • @AllThingsJavaScript
      @AllThingsJavaScript  4 года назад +1

      Solarized (light) color scheme

    • @dynamics
      @dynamics 4 года назад

      ​@@AllThingsJavaScript Thank you so much! 💛🌟🙏🏻 Am super grateful for your channel - I love your videos and am excited to dive deeper. Thank you for helping us students learn! 😊💗 💛