Calendar获取星期

时间:2014-05-22 04:19:03   收藏:0   阅读:196

Calendar的使用举个小栗子:

//通过当前时间获取本周周一时间

Date date = new Date();
Calendar calendar = new GregorianCalendar();
calendar.setTime(date );
calendar.add(Calendar.DATE,i + 1 - (calendar.get(Calendar.DAY_OF_WEEK) - 1) );
date = calendar.getTime();

Calendar获取星期,布布扣,bubuko.com

评论(0)
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!