小编Jul*_*dor的帖子

react-native获取当前日

我试图在反应原生的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()不回我想要什么?

android get date react-native

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

android ×1

date ×1

get ×1

react-native ×1