标签:calendar类 string font oid hit 练习 orm date类 calendar
打印当前时间。学习使用Date类和Calendar类。(教材P194页)
代码
package javawork; import java.util.Calendar; public class Time { public static void main(String[] args) { Calendar calender=Calendar.getInstance(); int year=calender.get(Calendar.YEAR); int month=calender.get(Calendar.MONTH); int date=calender.get(Calendar.DATE); int hour=calender.get(Calendar.HOUR_OF_DAY); int minute=calender.get(Calendar.MINUTE); int second=calender.get(Calendar.SECOND); int week=calender.get(Calendar.DAY_OF_WEEK); System.out.println(year + "/" + month + "/" + date + " " +hour + ":" +minute + ":" + second + "星期:"+(week-1)); } }
运行结果
标签:calendar类 string font oid hit 练习 orm date类 calendar
原文地址:http://www.cnblogs.com/songqinzhe/p/7843709.html