getSeconds()

ES1+

Returns the seconds (0-59) in the specified date according to local time.

Syntax

date.getSeconds()

Return Value

number

A number (0-59) representing the seconds

Examples

JavaScript
const date = new Date('2024-01-15T14:30:45');
console.log(date.getSeconds());
Output:
// 45

Related Methods