MCPcopy
hub / github.com/bitpay/bitcore / formatTimestamp

Function formatTimestamp

packages/bitcore-logging/src/timestamp.ts:6–22  ·  view source on GitHub ↗
(date: Date)

Source from the content-addressed store, hash-verified

4 .pop();
5
6export const formatTimestamp = (date: Date): string =>
7 `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date
8 .getDate()
9 .toString()
10 .padStart(2, '0')} ${date
11 .getHours()
12 .toString()
13 .padStart(2, '0')}:${date
14 .getMinutes()
15 .toString()
16 .padStart(2, '0')}:${date
17 .getSeconds()
18 .toString()
19 .padStart(2, '0')}.${date
20 .getMilliseconds()
21 .toString()
22 .padStart(3, '0')} ${timezone}`;
23
24export const timestamp = (): string => formatTimestamp(new Date());

Callers 3

timestamp.test.tsFile · 0.90
timestampFunction · 0.85
LogPhaseFunction · 0.85

Calls 2

getDateMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected