- MomentJS Tutorial
- MomentJS - Home
- MomentJS - Overview
- MomentJS - Environment Setup
- MomentJS - Introduction
- MomentJS - Parsing Date And Time
- MomentJS - Date Validation
- MomentJS - Getter/Setter
- Manipulate Date And Time
- Formatting Date And Time
- MomentJS - Date Queries
- MomentJS - Internationalization
- MomentJS - Customization
- MomentJS - Durations
- MomentJS - Utilities
- MomentJS - Plugins
- MomentJS - Examples
- MomentJS Useful Resources
- MomentJS - Quick Guide
- MomentJS - Useful Resources
- MomentJS - Discussion
MomentJS - Second
This method will get/set the seconds. It takes input from 0-59; if greater than the range provided, then it will add to the minutes.
Syntax
moment().second(Number); moment().second(); moment().seconds(Number); moment().seconds();
Example
var m = moment().second(); //gives current second var d = moment().second(10); //sets the second to 10 as shown below
Output
momentjs_getter_setter.htm
Advertisements