如何在Java中获取当周第一天的时间戳?

时间:2015-08-12 03:20:29

标签: java calendar

cal.get()方法是什么意思?

    public static int getTimesWeekmorning(){

    Calendar cal = Calendar.getInstance(); 
    cal.set(cal.get(Calendar.YEAR),cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 0, 0,0);                              
    cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); 
    return (int) (cal.getTimeInMillis()/1000); 
    } 

0 个答案:

没有答案