Prev Demo
JavaScript
>
Gettime() Method
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <p>Click the below button to return the number of years between from 13/oct/2002 to 13/oct/2015.</p> <input type="button" value="Click" onclick="myDate()" /> <p id="myId"></p> <script> function myDate() { var min = 3600 * 60; var hrs = min * 60; var days = hrs * 24; var years = days * 365; var A = new Date(); var R = A.getTime(); var Z = Math.round(R / years); document.getElementById("myId").innerHTML = Z; } </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output