How do I represent the current time with a variable?

This question already has an answer here:

  • How do I get the current date in JavaScript? 39 answers

  • <script>
        var now = new Date(); // actual time
    </script>
    

    The simplest thing! If you google for 3 seconds you can get tons of articles.

    var currentTime = new Date();
    

    Something like this?

    var dt = new Date();

    var time = dt.getHours()+" : "+dt.getMinutes()

    //Append current hours and minutes together. Append dt.getSeconds() to get current time upto the second.

    链接地址: http://www.djcxy.com/p/77528.html

    上一篇: Jquery / JEasyUI如何获取当前日期?

    下一篇: 我如何用变量表示当前时间?