How do you get a timestamp in JavaScript?

JavascriptWeb DevelopmentFront End Technology

To get the timestamp in Java Script, you can try to run the following code. It returns the timestamp since 1970/01/01

Example

Live Demo

<!DOCTYPE html>
<html>
   <body>
      <script>
         var timeStamp = Math.floor(Date.now() / 1000);
         document.write("TimeStamp= "+timeStamp);
      </script>
   </body>
</html>
raja
Published on 24-Jan-2018 10:27:39
Advertisements