Alvin
Alvin

Reputation: 8499

react-native Date not return as converted timezone

How to make Date without timsezone converted inside React Native app?

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

It give 2019-11-14T00:00:00.000Z?

How do I make sure it is 15th?

Upvotes: 0

Views: 238

Answers (1)

dmitri7
dmitri7

Reputation: 193

Date:

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());

String:

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

Upvotes: 1

Related Questions