Get second of current day - Javascript Date Operation

Javascript examples for Date Operation:Day

Description

Get second of current day

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=( function() {/*from  www .  ja  v  a2 s. c  om*/
var today = new Date();
var today_abs = new Date();
today_abs.setHours(0);
today_abs.setMinutes(0);
today_abs.setSeconds(0);
today_secs = (today.getTime() - today_abs.getTime()) / 1000;
console.log(today_secs);
    });

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials