
- 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
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
MomentJS - Hours
This method will display the hours in the duration. The value returned will be between 0-23. In case you need the proper length of hours in that duration, make use of moment.duration().asHours();
Syntax
moment.duration().hours(); moment.duration().asHours();
Example
var h = moment.duration(500, "hours").hours(); var ashrs = moment.duration(500, "hours").asHours();
Output

momentjs_durations.htm
Advertisements