//获取当天(按当前传入的时区)00:00:00所对应时刻的long型值
private long getStartTimeOfDay(long now, String timeZone) {
String tz = TextUtils.isEmpty(timeZone) ? "GMT+8" : timeZone;
TimeZone curTimeZone = TimeZone.getTimeZone(tz);
Calendar calendar = Calendar.getInstance(curTimeZone);
calendar.setTimeInMillis(now);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTimeInMillis();
}
//获取当天(按当前传入的时区)00:00:00所对应时刻的calendar
private Calendar getStartTimeOfDay() {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar;
}