Skip to content

Files

Latest commit

 

History

History
13 lines (9 loc) · 325 Bytes

getColonTimeFromDate.md

File metadata and controls

13 lines (9 loc) · 325 Bytes

getColonTimeFromDate

Returns a string of the form HH:MM:SS from a Date object.

Use Date.toString() and String.slice() to get the HH:MM:SS part of a given Date object.

const getColonTimeFromDate = date => date.toTimeString().slice(0, 8);
getColonTimeFromDate(new Date()); // "08:38:00"