17 lines
487 B
HTML
17 lines
487 B
HTML
|
<html>
|
||
|
<head>
|
||
|
<title>JavaScript Get Seconds</title>
|
||
|
</head>
|
||
|
<body>
|
||
|
<script>
|
||
|
var date1, date2;
|
||
|
date1 = new Date();
|
||
|
document.write(""+date1);
|
||
|
date2 = new Date( "Feb 18, 2020 09:30:10" );
|
||
|
document.write("<br>"+date2);
|
||
|
// get total seconds between two dates
|
||
|
var seconds = Math.abs(date1 - date2) / 1000;
|
||
|
document.write("<br>Difference between 2 dates: "+seconds);
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|