I\'m trying to format a Date String in React Native.
Ex: 2016-01-04 10:34:23
Following is the code I\'m using.
var date = new Date(\"2016-01-
The Date constructor is very picky about what it allows. The string you pass in must be supported by Date.parse(), and if it is unsupported, it will return NaN. Different versions of JavaScript do support different formats, if those formats deviate from the official ISO documentation.
See the examples here for what is supported: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse