reactjs - Using React-Moment, (moment.js) How do I get date format: Mon Apr 19 1976 09:59:00 from format 2017-08-07 08:42:08? -
i'm trying convert date format 2017-08-07 08:42:08
format mon apr 19 1976 0:59:00
using react-moment
library.
i went through docs @ [https://www.npmjs.com/package/react-moment][1]
, tried similar examples, nothing fits need exactly.
i can do:
<moment fromnow>{datetime}</moment>
yields format:
in 10 days
but
<moment unix>{datetime}</moment>
yields
invalid date
<moment parse="yyyy-mm-dd hh:mm:ss"> {datetime} </moment>
yields: mon aug 07 2017 08:47:47 gmt+0545
. don't without timezone value @ end. what's correct parameter date format input?
as per documentation in npm default format want. because default format of js, mentioned in w3schools
<moment format="here desire format">{datetime}</moment>
*optional: please try install moment-timezone mentioned in link.
Comments
Post a Comment