Java-Calender日历类
package com.lmw.time;
import org.junit.Test;
import java.util.Calendar;
import java.util.Date;
public class CalenderTest {
@Test
public void test() {
Calendar calendar = Calendar.getInstance();
System.out.println(calendar.get(Calendar.DAY_OF_MONTH));
System.out.println(calendar.get(Calendar.DAY_OF_YEAR));
calendar.set(Calendar.DAY_OF_MONTH,22);
System.out.println(calendar.get(Calendar.DAY_OF_MONTH));
calendar.add(Calendar.DAY_OF_MONTH,1);
System.out.println(calendar.get(Calendar.DAY_OF_MONTH));
calendar.add(Calendar.DAY_OF_MONTH,-1);
System.out.println(calendar.get(Calendar.DAY_OF_MONTH));
Date time = calendar.getTime();
System.out.println(time);
Date date1 = new Date();
calendar.setTime(date1);
calendar.get(Calendar.DAY_OF_MONTH);
}
}
ar.DAY_OF_MONTH);
}
}