Use moment.js to handle dates and times in JavaScript
Need to do mathy stuff on time? Convert time zines, parse, add, subtract, convert to fuzzy time (e.g., a moment ago, an hour ago)? Need it to work on your Arabic language site too?
Just use moment.js
Description: A 5.5kb javascript date library for parsing, validating, manipulating, and formatting dates.
Written by James Van Dyke
Related protips
2 Responses
Is it possible to get current date using today relative keyword? Something like:
var date = moment('today');
???
over 1 year ago
·
Not using a keyword, but you can by simply calling the moment() function itself, like so:
var now = moment()
For the details about parsing, see http://momentjs.com/docs/#/parsing/now/
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Datetime
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#