1. 程式人生 > >Java之Date簡單測試

Java之Date簡單測試

public class Demo01 {
	@Test
	public void test() {
		Date now=new Date();
		System.err.println(now);
		System.out.print("");
		int date=now.getDate();
		System.out.println(date);
		int mon=now.getMonth();
		System.out.println(mon);//0,11代表1月,12月
		int day=now.getDay();
		System.out.println(day);
	}
	@Test
	public void test1() {
		long currentTimeMillis = System.currentTimeMillis();
		Date now_10 = new Date(currentTimeMillis-1000*60*10);
		System.out.println(now_10);
	}
}