简体   繁体   中英

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?

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

you can try this as well, it is working fine

var today = new Date();    
var day = today.getDate(); -> it will return the current day i.e 15

or,

var today = new Date('2019-11-15T00:00:00+00:00');
print(today.getDate()); -> it will return you the current day from the given date i.e 15

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