getSeconds()
JavaScript Date getSeconds() method
Last Updated : 17 Mar 2025
The JavaScript date getSeconds() method returns the seconds in the specified date on the basis of local time.
Syntax
The getSeconds() method is represented by the following syntax:
Return
An integer value between 0 and 59 that represents the second.
JavaScript Date getSeconds() method example
Here, we will understand getSeconds() method through various examples.
Example 1
Let's see an example to print the value of current second.
Output:
Example 2
Let's see an example to print the value of seconds from the given date.
Output: