package er;
import java.util.Calendar;
import java.util.Date;
public class question {
public static void main(String[] args) {
Date nowtime = new Date();
System.out.println(nowtime);
Date date1 = new Date(1000);
System.out.println(date1);
Calendar calebdar1 = Calendar.getInstance();
int year,month,day;
year = calebdar1.get(Calendar.YEAR);
month = calebdar1.get(calebdar1.MONTH)+1;
day = calebdar1.get(Calendar.DAY_OF_MONTH);
System.out.println("今天是"+year+"年"+month+"月"+day+"日");
}
}
打印当前时间。学习使用Date类和Calendar类。
最新推荐文章于 2024-05-29 19:27:26 发布