java中怎么判断今天是周几
收起
云计算小粉
2018-05-10 20:08:55
3623
0
3
条回答
写回答
取消
提交回答
-
用Calendar类
2019-07-17 22:17:56
-
public static void main(String[] args) {
LocalDate localDate = LocalDate.of(2018, 5, 16);
DayOfWeek dayOfWeek = localDate.getDayOfWeek();
System.out.println(dayOfWeek);
}
2019-07-17 22:17:56
-
Calendar a = Calendar.getInstance();
int week = a.get(Calendar.DAY_OF_WEEK);
2019-07-17 22:17:56