I retrieve the data from MongoDB,and it contains date, but the date is String format. I'm trying to use following codes to format the date:
var str = data.date;// assume that is 2002/2/2
var date = new Date(str);
console.log(date);
However the output is :Sat Feb 02 2002 00:00:00 GMT+1100 (AEDT) How can I make the output become the YYYY/MM/DD? Many thanks .