Calendar calendar = Calendar.getInstance();
int hour = calendar.get(Calendar.HOUR_OF_DAY); // 24小时制
System.out.println(hour);
hour = calendar.get(Calendar.HOUR); // 12小时制
System.out.println(hour);
05-23
1726
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-13
2319
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
06-06