java获取当前日期是星期几
2009-04-23 20:54:53 来源:WEB开发网核心提示: /** * 获取当前日期是星期几<br> * * @param dt * @return 当前日期是星期几 */ public static String getWeekOfDate(Date dt) { String[] weekDays = {"星期日", "星期一
/**
* 获取当前日期是星期几<br>
*
* @param dt
* @return 当前日期是星期几
*/
public static String getWeekOfDate(Date dt) {
String[] weekDays = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
Calendar cal = Calendar.getInstance();
cal.setTime(dt);
int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
if (w < 0)
w = 0;
return weekDays[w];
}
更多精彩
赞助商链接