ucap-doc/documents/업무/2월/3째주/date-seconds.html
2020-02-18 18:07:19 +09:00

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>