JavaScript getSeconds()Method
Examples
Return the seconds of the time according to local time:
var d = new Date();
var n = d.getSeconds();
var n = d.getSeconds();
nOutput:
Try it Yourself »
Definition and Usage
The getSeconds() method returns the seconds of a time. The return value is an integer between 0 and 59.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the getSeconds() method
Syntax
Date.getSeconds()
Return Value
| Type | Description |
|---|---|
| Number | The return value is an integer between 0 and 59. |
Technical Details
| JavaScript Version: | 1.0 |
|---|
More Examples
Display the current time
How to use getHours(), getMinutes() and getSeconds() to display the current time.
Other Extensions
JavaScript Date Object