获取当前时间所在的周期中的所有时间

		 //      获取当前时间
            Date date = new Date(System.currentTimeMillis());
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日");// HH:mm:ss
            String format = simpleDateFormat.format(date);
            String yeas = format.substring(0, 4);
            Date now = new Date();
            long nowTime = now.getTime() ;
            int day = now.getDay();
            long oneDayLong = 24*60*60*1000 ;

            long MondayTime = nowTime - (day-1)*oneDayLong;
            long TuesdayTime = nowTime - (day-2)*oneDayLong;
            long WednesdayTime = nowTime - (day-3)*oneDayLong;
            long ThursdayTime = nowTime - (day-4)*oneDayLong;
            long FridayTime = nowTime - (day-5)*oneDayLong;
            long SaturdayTime = nowTime - (day-6)*oneDayLong;
            long SundayTime =  nowTime + (7-day)*oneDayLong ;

            Date monday = new Date(MondayTime);
            Date tuesday = new Date(TuesdayTime);
            Date wednesday = new Date(WednesdayTime);
            Date thursday = new Date(ThursdayTime);
            Date friday = new Date(FridayTime);
            Date saturday = new Date(SaturdayTime);
            Date sunday = new Date(SundayTime);
            String mon=yeas+(monday.getMonth() + 1) +monday.getDate();
            String tues=yeas+ (tuesday.getMonth() + 1) + tuesday.getDate();
            String wednes=yeas + (wednesday.getMonth() + 1) +wednesday.getDate();
            String thurs=yeas+ (thursday.getMonth() + 1) + thursday.getDate();
            String fri=yeas+ (friday.getMonth() + 1) + friday.getDate();
            String satur=yeas + (saturday.getMonth() + 1) + saturday.getDate();
            String sun=yeas + (sunday.getMonth() + 1) + sunday.getDate();

获取当前时间所在的周期中的所有时间_第1张图片

你可能感兴趣的:(android,闲杂)