Date/time conversion using moment.js
-
13-12-2019 - |
سؤال
I would like to use moment.js for date conversion.
Here's what I want:
var original_format = "Tuesday, May 22, 2012";
var output1 = "16 hours ago"
var output2 = "2012-05-22T00:00:00+02:00"
For the output1 no problem, for the second-one would it be possible to make it using moment.js?
moment("original_format").fromNow(); // "16 hours ago"
المحلول
moment("original_format").format();
لا تنتمي إلى StackOverflow