getSeconds method
The getSeconds method is applied
to the date object
and returns the current seconds value
(a number from 0 to 59).
Syntax
date.getSeconds();
Example
Let's output the current number of seconds:
let date = new Date();
let res = date.getSeconds();
console.log(res);
See also
-
the
getHoursmethod
that gets the hours -
the
getMinutesmethod
that gets the minutes -
the
getSecondsmethod
that gets the seconds -
the
getMillisecondsmethod
that gets the milliseconds