首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    JAVA给定两个日期判断是第几周(中…

    public static String getWeekCounterByEventStartDate(String event_s_date, String dailyDate) {         if (isSameWeek(event_s_date, dailyDate)) {             return "WK1";         }         Calendar c_base = Calendar.getInstance();         Calendar c2 = Calendar.getInstance();         Calendar tempC = Calendar.getInstance();         DateFormat df = new SimpleDateFormat("yyyy-MM-dd");         int week = 0;         try {             c_base.setTime(df.parse(event_s_date));             c2.setTime(df.parse(dailyDate));             Long time1 = c2.getTimeInMillis();             Long time2 = c_base.getTimeInMillis();             Long dayDiffer = Math.abs(time1 - time2) / (1000 * 60 * 60 * 24);//毫秒*秒*分*小时             if (dayDiffer.intValue() == 0) {                 week++;                 return "WK" + week;             }             int curTodayWeek = c_base.get(Calendar.DAY_OF_WEEK) - 1;             int differIsWeek = 7 - curTodayWeek;             tempC = (Calendar) c_base.clone();

    02
    领券