您的位置:首页 > 移动开发 > Android开发

android get current Time

2014-01-16 01:06 351 查看
Today ,I want to pick up the android,so I  write down a little demo,in the demo I most use the date,so I check some information,and read it down in case I will forget it.

Time time = new Time();

time.setToNow(); //It is very important,it's easy to be ignored.

then you can get the year,month,day& time

int year = time.year;

int month = time.month; //month is the current month -1,means month is the index of monthes。

int day=time.monthday;

textview.setText(year+“-”+month+"-"+day);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  android