Created
October 2, 2020 09:56
-
-
Save FreePhoenix888/221fe9ec0734383e52153399d14be688 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getSecondsToday() { | |
let now = new Date(); | |
let today = new Date(now.getFullYear(), now.getMonth(), now.getDate()); | |
let diff = now - today; // разница в миллисекундах | |
return Math.round(diff / 1000); // получаем секунды | |
} | |
alert( getSecondsToday() ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment