What is the simplest way to obtain an instance of new Date() but set the time at midnight?
The setHours
method can take optional minutes
, seconds
and ms
arguments, for example:
var d = new Date();
d.setHours(0,0,0,0);
That will set the time to 00:00:00.000
of your current timezone, if you want to work in UTC time, you can use the setUTCHours
method.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments