【问题标题】:react-native Date not return as converted timezonereact-native 日期不作为转换后的时区返回
【发布时间】:2020-03-11 18:30:49
【问题描述】:

如何在 React Native 应用中转换 Date without timsezone

new Date('2019-11-15T00:00:00+00:00')

它给2019-11-14T00:00:00.000Z

如何确定是 15 号?

【问题讨论】:

标签: javascript react-native


【解决方案1】:

日期:

const date = new Date('2019-11-15T00:00:00+00:00');
const date2 = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes());

字符串:

const date = new Date('2019-11-15T00:00:00+00:00');
date.toUTCString();

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-09-07
  • 1970-01-01
  • 2020-02-07
  • 1970-01-01
  • 1970-01-01
  • 2020-04-17
相关资源
最近更新 更多