HTML | DOM timeStamp Event Property
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:
After clicking the paragraph:
Supported Browsers: The browser supported by timeStamp Event property are listed below:
- Apple Safari
- Google Chrome
- Firefox
- Opera
- Internet Explorer 9.0
Please Login to comment...