728x90
function getSecondsTodayVerOne() {
const now = new Date();
const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
const diff = now - today;
return Math.round(diff / 1000);
}
function getSecondsTodayVerTwo() {
const now = new Date();
return now.getHours() * 3600 + now.getMinutes() * 60 + now.getSeconds();
}
console.log( getSecondsTodayVerOne() );
console.log( getSecondsTodayVerTwo() );

+ Recent posts