- 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 - Time to now
This method tells the length of time from the date given to now.
Syntax
moment().toNow(); moment().toNow(Boolean);
Example
var a = moment([2015, 3, 15]).toNow();
Output
If you want to remove the prefix, use true with toNow() as shown below −
Example
var a = moment([1995, 3, 15]).toNow(true);
Output
momentjs_formatting_date_and_time.htm
Advertisements
To Continue Learning Please Login
Login with Google