Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 10x 2x 2x 2x 2x | /**
* Returns a formatted date string by combining the current date, month, year and timestamp.
*
* @example ```ts
* const today = new Date('August 5, 2021 14:30:00');
* const formattedDate = formatDateStamp(today);
* console.log(formattedDate); // 20210805-1628165400000
* ```
*/
export const formatDateStamp = (date: Date) => {
const day = String(date.getDate()).padStart(2, '0')
const month = String(date.getMonth() + 1).padStart(2, '0')
const year = String(date.getFullYear())
return `${year}${month}${day}-${date.getTime()}`
}
|