public int gethour() { Calendar c = Calendar.getInstance(); int hour = c.get(Calendar.HOUR_OF_DAY); return hour; }
只取小时单位,可以跟据当前时间来判断餐别。
String ly_time = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime());
取到年月日。