Answers for "Javascript new Date start of day"

6

get start of day javascript

var start = new Date();
start.setHours(0,0,0,0);

var end = new Date();
end.setHours(23,59,59,999);

alert( start.toUTCString() + ':' + end.toUTCString() );
Posted by: Guest on May-26-2020
0

execute a function at a certain time of day js

window.setInterval(function(){ // Set interval for checking
    var date = new Date(); // Create a Date object to find out what time it is
    if(date.getHours() === 8 && date.getMinutes() === 0){ // Check the time
        // Do stuff
    }
}, 60000); // Repeat every 60000 milliseconds (1 minute)
Posted by: Guest on August-09-2021

Code answers related to "Javascript new Date start of day"

Code answers related to "Javascript"

Browse Popular Code Answers by Language