Skip to content

utils.formatTime()

We can format time with _spy.utils.formatTime().

js
_spy.utils.formatTime(new Date());
ts
formatTime(
  dateValue: Date,
  format?: string,
): string;

format string will be interpreted as below.

expressionsummaryexample
yyyyyear in 4 digits2025
MMmonth in 2 digits01
ddday in 2 digits02
HHhours in 2 digits03
mmminutes in 2 digits04
ssseconds in 2 digits05
fffmilliseconds in 3 digits006

about default format

default format string is below

  • HH:mm:ss.fff