java 获取当前是本年、本月、本季度 第几周
import java.util.Calendar; public class Date6 { public static void main(String[] args) { Calendar c = Calendar.getInstance(); int month=c.get(c.WEEK_OF_MONTH); int week = c.get(c.WEEK_OF_YEAR); String quarter=""; int m=c.get(c.MONTH); if (m >= 1 && m == 3) { quarter = "1"; } else if (m >= 4 && m <= 6) { quarter = "2"; } else if (m >= 7 && m <= 9) { quarter = "3"; } else { quarter = "4"; } System.out.println("今天是今年的第" + week + "周;"); System.out.println("今天是今月的第" + month + "周;"); System.out.println("当前季度为"+quarter+"季度"); } }