<HTML>
<body>
</body>
<script>
function getSecondsToday(){
let stamp = new Date();
let date = new Date(stamp.getFullYear(), stamp.getMonth(), stamp.getDate());
//following two lines are from solution
let diff = stamp.getTime() - date.getTime();
return Math.round(diff / 1000); // making seconds
//getTime returns miliseconds
}
alert(getSecondsToday());
</script>
</HTML>
<body>
</body>
<script>
function getSecondsToday(){
let stamp = new Date();
let date = new Date(stamp.getFullYear(), stamp.getMonth(), stamp.getDate());
//following two lines are from solution
let diff = stamp.getTime() - date.getTime();
return Math.round(diff / 1000); // making seconds
//getTime returns miliseconds
}
alert(getSecondsToday());
</script>
</HTML>
댓글
댓글 쓰기