根据日期转换星期几的工具类

public static String getWeekOfDate(Date date)
{
String[] weekOfDays={"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};
Calendar calendar=Calendar.getInstance();
if(date!=null)
{
calendar.setTime(date);
}
int w=calendar.get(Calendar.DAY_OF_WEEK)-1;
if(w<0)
{
w=0;
}
return weekOfDays[w];
}

猜你喜欢

转载自cm1993.iteye.com/blog/2233179
今日推荐