Javascript Reference - JavaScript getSeconds() Method








getSeconds()
Returns the date's seconds as a number between 0 and 59.

Browser Support

getSeconds() Yes Yes Yes Yes Yes

Syntax

dateObject.getSeconds();

Parameters

None

Return Value

return a number, from 0 to 59, representing the seconds.





Example


var myDate = new Date();
console.log(myDate.getSeconds());

The code above generates the following result.