Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 在物料表中JS日期格式时,如何维护时间和日期?_Reactjs_React Hooks_Material Table - Fatal编程技术网

Reactjs 在物料表中JS日期格式时,如何维护时间和日期?

Reactjs 在物料表中JS日期格式时,如何维护时间和日期?,reactjs,react-hooks,material-table,Reactjs,React Hooks,Material Table,所以我想转换js日期格式 ex: 2020-12-23T07:05:58.000Z 到ISO日期格式的材料表,但我也想保持时间 为了这个我试过了 const columns = { title: "Date", field: "date", type: "date", dateSetting: { locale: "en-GB" }, } 但它给出的输出是:12

所以我想转换js日期格式

ex: 2020-12-23T07:05:58.000Z
到ISO日期格式的材料表,但我也想保持时间

为了这个我试过了

 const columns = {
      title: "Date",
      field: "date",
      type: "date",
      dateSetting: { locale: "en-GB" },
 }

但它给出的输出是:12/23/2020,但我也希望时间是12/23/2020 07:05。

我找到了解决方案,如果有人想转换,他们可以这样做

  const columns = {
        field: 'receivedOn',
        title: 'Date',
        type: "datetime",
    },
它将给出适当的日期和时间:2020年12月23日,下午12:35:58