当前位置: 技术问答>java相关
如何去系统的当前时间?
来源: 互联网 发布时间:2015-01-13
本文导语: | Calendar cal = Calendar.getInstance(); int min = cal.get(cal.MINUTE); int second =cal.get(cal.SECOND); ... | calendar取出的是24小时制的呀! 你这样取: Calendar current_date=Calendar.getInstance(); currenthour=current_date.get(Calen...
|
Calendar cal = Calendar.getInstance();
int min = cal.get(cal.MINUTE);
int second =cal.get(cal.SECOND);
...
int min = cal.get(cal.MINUTE);
int second =cal.get(cal.SECOND);
...
|
calendar取出的是24小时制的呀!
你这样取:
Calendar current_date=Calendar.getInstance();
currenthour=current_date.get(Calendar.HOUR_OF_DAY);
currentminute=current_date.get(Calendar.MINUTE);
currentsecond=current_date.get(Calendar.SECOND);
你这样取:
Calendar current_date=Calendar.getInstance();
currenthour=current_date.get(Calendar.HOUR_OF_DAY);
currentminute=current_date.get(Calendar.MINUTE);
currentsecond=current_date.get(Calendar.SECOND);