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.
More Related Contents:
- How does this code call id with html?
- What’s the difference between event.stopPropagation and event.preventDefault?
- How to save an HTML5 Canvas as an image on a server?
- How can I unset a JavaScript variable?
- Is it possible to send a variable number of arguments to a JavaScript function?
- Cross browser JavaScript (not jQuery…) scroll to top animation
- How do I upload a file with the JS fetch API?
- How can I guarantee that my enums definition doesn’t change in JavaScript?
- How to create a dialog with “Ok” and “Cancel” options
- Restricting input to textbox: allowing only numbers and decimal point
- How to swap two variables in JavaScript
- How to show progress bar while loading, using ajax
- Handling errors in express async middleware
- Prevent form submission with enter key
- Server Side Calculation using Firebase
- Download Canvas as PNG in fabric.js giving network Error
- What events does an fire when its value is changed?
- Discord.js Bot Welcomes Member, Assign a Role and send them a DM
- What’s the difference between putting script in head and body?
- Binding vs Arrow-function (in JavaScript, or for react onClick)
- Calculate working days between two dates in Javascript excepts holidays
- Javascript: best Singleton pattern [duplicate]
- Can’t resolve module (not found) in React.js
- Highcharts percentage of total for simple bar chart
- (*SKIP)(*FAIL) workaround in JavaScript RegExp
- Convert JavaScript String to be all lowercase
- How to create a custom input type?
- How can I dynamically highlight strings on a web page?
- how to fire event on file select
- How to convert a byte array into an image?