ucap-doc/documents/업무/2월/3째주/date-seconds.html

17 lines
487 B
HTML
Raw Permalink Normal View History

2020-02-18 09:07:19 +00:00
<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>