我试图在反应原生的Android应用程序中获取当前日/月/年.
这就是我所做的:
currentDay: new Date(),
...
console.log('Date:'+this.state.currentDay ,);
console.log('Day: '+this.state.currentDay.getDay() , 'Month: ' + this.state.currentDay.getMonth(), 'Year :'+ this.state.currentDay.getYear());
Run Code Online (Sandbox Code Playgroud)
在控制台我有:
Date:Fri Jun 16 2017 11:27:36 GMT+0000 (GMT)
'Day: 5', 'Month: 5', 'Year :117'
Run Code Online (Sandbox Code Playgroud)
正如你看到的,getDay(),getMonth()并且getYear()不回我想要什么?