-
Notifications
You must be signed in to change notification settings - Fork 1
clearTime
kherP edited this page Jan 2, 2020
·
2 revisions
This utility sets hour, minute, second and millisecond of a Date object to zero. To use it, pass a Date object. If variable passed is not a valid Date object, a default TODAY's date will be assigned.
const date = new Date("December 17, 1995 03:24:00");
const result = clearTime(date);
console.log(result.toLocaleString()); // "12/17/1995, 12:00:00 AM"| Param | Type | Description |
|---|---|---|
| date | Date | The date object to be set to midnight |