关于获得当前周的下一周
来源:百度知道 编辑:UC知道 时间:2024/06/04 05:48:23
package com.zhh.test;
import java.util.Calendar;
public class Week {
public static void main(String[] args) {
Calendar now = Calendar.getInstance();
int week = now.get(Calendar.WEEK_OF_YEAR);
int day = now.get(Calendar.DAY_OF_WEEK);
System.out.println(now.get(Calendar.DAY_OF_WEEK));
System.out.println(week);
now.add(Calendar.WEEK_OF_YEAR, 1);
//System.out.println(now.get(Calendar.) + "day" + (now.get(Calendar.MONTH) + 1) + "month");
now.add(Calendar.DAY_OF_WEEK, 1 - day);
System.out.println("start date: " + now.get(Calendar.DAY_OF_MONTH) + "day" + (now.get(Calendar.MONTH) + 1) + "month");
now.add(Calendar.DAY_OF_WEEK, 6);
System.out.println("end date: " + now.get(Calendar.DAY_OF_MONTH) + "day" + (now.get(Calendar.MONTH) + 1) + "month");
}
}