Skip to content
Related Articles

Related Articles

HTML | DOM timeStamp Event Property
  • Last Updated : 18 Jan, 2019

The timeStamp Event property is used to get the timestamp of when a particular event is created. It basically returns the difference in time (in milliseconds) between the time of event created by the browser and January 1, 1970.

It is a read-only property.

Syntax:

event.timeStamp

Return Value: : This event returns the number of milliseconds since January 1, 1970 and when the event is triggered.

Example:




<!DOCTYPE html>
<html>
    <head>
        <title>DOM timeStamp Event Property</title>
    </head>
  
    <body onwheel="Geeks(event)" 
          style="text-align:center">
      
        <h1 style="color: green;">
            GeeksforGeeks
        </h1>
          
        <h2>DOM timeStamp Event Property</h2>
          
        <p onclick="Geeks(event)">
            The click event occurred 
            <span id = "s" style="color:green">
                unknown
            </span
            milliseconds after January 1, 1970.
        </p
          
        <script>
            function Geeks(event) {
                var doc = event.timeStamp;
                document.getElementById("s").innerHTML = doc;
            }
        </script>
    </body>
</html>                    


Output:
Before clicking the paragraph:
timestamp
After clicking the paragraph:
timestamp
Supported Browsers: The browser supported by timeStamp Event property are listed below:

  • Apple Safari
  • Google Chrome
  • Firefox
  • Opera
  • Internet Explorer 9.0

full-stack-img




My Personal Notes arrow_drop_up
Recommended Articles
Page :