A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

本帖最后由 heshiwei 于 2015-10-1 09:19 编辑

1.
Time time = new Time("GMT+8");
time.setToNow(); //Sets the time of the given Time object to the current time. 将事件获取对象置为当前时间

System.out.println(time.hour);
System.out.println(time.minute);
System.out.println(time.second);

2.
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
String str = sdf.format(new Date());

3.
Calendar calendar = Calendar.getInstance();
int hour = calendar.HOUR_OF_DAY;
int minute = calendar.MINUTE;
int second = calendar.SECOND;

3 个回复

正序浏览
可以的 学习了
回复 使用道具 举报
又涨姿势了
回复 使用道具 举报
学习了,学习
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马