Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6426

How to convert to Date in Java Script?

$
0
0
console.log(json[0].aDate);    //Mar 4 ,2022 10 30 PMconst date = new Date(json[0].aDate); // Date{NaN}const date = moment(json[0].aDate).format('YYYY-MM-DD HH:mm:ss'); // Invailed Date

Is there any other way?

I've tried new Date(), moment.js and moment(),format('YYYY-MM-DD HH:mm:ss') but that doesn't work.

I expect the following result:
console(date) //'2022-3-4 10:30:SS'


Viewing all articles
Browse latest Browse all 6426

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>