java获取当前时间的小时
作者:互联网
转载:https://blog.csdn.net/iamzhangyouzhi/article/details/38542401
方法一:
Date date = new Date(); int hours = date.getHours();
方法二:
GregorianCalendar calendar = new GregorianCalendar(); int hour = calendar.get(Calendar.HOUR_OF_DAY); System.out.println("hour=" + hour);
标签:java,hour,int,获取,new,Date,小时,calendar,GregorianCalendar 来源: https://www.cnblogs.com/flypig666/p/12469315.html