嘿,伙计们,我使用Android时间来获取我的健康数据,我得到了周和月的第一个日期,但我没有得到一天的开始时间,我得到这样的输出
start: Thu, 1 Feb 2019 18:30:00 UTC 6:30 pm EndSun, 31 Mar 2019 12:47:15 UTC 12:47 pm
我想把时间花在
enter code here
start: Thu, 1 Feb 2019 00:00:00 UTC 00:00 pm End Sun, 31 Mar 2019 23:59:59 UTC 11:59 pm
im使用该函数来获取一周和一个月中的时间
public static long getStartTimeOfWeek() {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
cal.set(Calendar.DAY_OF_WEEK, 1);
return cal.getTimeInMillis()+ ONE_DAY;
}
月份 :
public static long getMonthDateFirstdate(){
Calendar cal = Calendar.getInstance();
cal.clear(Calendar.MINUTE);
cal.clear(Calendar.SECOND);
cal.clear(Calendar.MILLISECOND);
cal.set(Calendar.DATE,cal.getActualMinimum(Calendar.DAY_OF_MONTH));
return cal.getTimeInMillis();
}
白衣染霜花
拉莫斯之舞
忽然笑
相关分类