简体   繁体   中英

Convert date using react-moment

I am using react-moment and trying to convert a date which is in this format 14-Mar-2018 08:23:17 to 03/14/2018 08:23:17. How do I go about doing this? I am trying to render it in bootstrap-table-next.

const dateFormatter = (cell, row) => (
  <Moment parse="MM/dd/yyyy HH:mm:ss">
    {row}
  </Moment>
);

Try:

const dateFormatter = (cell, row) => (
  <Moment format="MM/dd/yyyy HH:mm:ss">
    {row}
  </Moment>
);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM