483 B
483 B
title, tags, cover, firstSeen, lastUpdated
| title | tags | cover | firstSeen | lastUpdated |
|---|---|---|---|---|
| Get colon time from date | date,string | digital-nomad-5 | 2018-01-13T17:14:48+02:00 | 2020-10-19T22:49:51+03:00 |
Returns a string of the form HH:MM:SS from a Date object.
- Use
Date.prototype.toTimeString()andString.prototype.slice()to get theHH:MM:SSpart of a givenDateobject.
const getColonTimeFromDate = date => date.toTimeString().slice(0, 8);
getColonTimeFromDate(new Date()); // '08:38:00'