use*_*265 1 java time calendar
public void getTime() { Calendar calendar = Calendar.getInstance(); calendar.getTime(); this.minutes = calendar.MINUTE; this.hours= calendar.HOUR_OF_DAY; }
鉴于此代码将变量分钟和小时设置为当前时间的整数值?它似乎没有出现问题吗?
new*_*ser 5
尝试这样可以从当天的日历实例中获取分钟和小时
this.minutes = calendar.get(Calendar.MINUTE); this.hours= calendar.get(Calendar.HOUR_OF_DAY);
Calendar.MINUTE并且Calendar.HOUR_OF_DAY是常量,它只给出int值.将int值应用于日历实例并获取"分钟"和"小时"值.
Calendar.MINUTE
Calendar.HOUR_OF_DAY
归档时间:
11 年,10 月 前
查看次数:
5238 次
最近记录: