Latest web development tutorials

JavaScript getSeconds () method

Date Object Reference JavaScript Date Object

Examples

Returns the time in seconds according to local time:

var d = new Date();
var n = d.getSeconds();

n output:


try it"

Definition and Usage

getSeconds () method returns the time in seconds. The return value is an integer of 0 to 59.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support getSeconds () method


grammar

Date.getSeconds()

return value

类型 描述
Number 返回值是 0 ~ 59 之间的一个整数。

technical details

JavaScript version: 1.0


Examples s

More examples

Displays the current time
How getHours (), getMinutes () and getSeconds () to display the current time.


Date Object Reference JavaScript Date Object