【android SDK _ 时间】台历类获得指定日期的星期不正确
【android SDK _ 时间】日历类获得指定日期的星期不正确?
我的部分代码如下:
结果topBar(TextView) 的显示结果是 Y:2014 W:5 M:4 D:1
可是windows下的日历 2014的4月1日是星期二。。。。不知道那个week为啥会是5
谢谢大伙纠错!
------解决方案--------------------
2014年5月1日 星期四这样一个意思
我的部分代码如下:
//section 1
private Calendar c;
private TextView topBar;
private int monthday[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
//section 2
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
.......
TimeZone MyTimezone = TimeZone.getDefault();
c = new GregorianCalendar(MyTimezone);
c.set(2014, 4, 1);
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH);
int week = c.get(Calendar.DAY_OF_WEEK);
int day = c.get(Calendar.DAY_OF_MONTH);
topBar.setText("Y:"+year+" W:"+week +" M:"+ month+ " D:"+day);
}
结果topBar(TextView) 的显示结果是 Y:2014 W:5 M:4 D:1
可是windows下的日历 2014的4月1日是星期二。。。。不知道那个week为啥会是5
谢谢大伙纠错!
------解决方案--------------------
2014年5月1日 星期四这样一个意思