简体   繁体   English

使用反应时刻转换日期

[英]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.我正在使用 react-moment 并尝试将格式为 14-Mar-2018 08:23:17 的日期转换为 03/14/2018 08:23:17。 How do I go about doing this?我该怎么做呢? I am trying to render it in bootstrap-table-next.我正在尝试在 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>
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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