如何获得指定周的起始日期和结束日期, 如何考虑跨年问题 如何获得指定周的起始日期和结束日期 比如 2006年第2周从 X月X日 ~ X月X日如何考虑跨年问题 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 calender类就可以解决,看一下sdk吧 //已知某年ryear 自然周rweek,计算该周的第一天对应的日期 SimpleDateFormat temp_DateFormat = new SimpleDateFormat("yyyy-MM-dd"); Calendar temp_cal1 = Calendar.getInstance(); //只设置了年和周的field,生成的日历会以当前日期是星期几来设置日历的星期 temp_cal1.set(Calendar.YEAR, Integer.valueOf(this.ryear)); temp_cal1.set(Calendar.WEEK_OF_YEAR, Integer.valueOf(this.rweek)); //减去星期几对应的数字,就会得出该周第一日(即星期天)对应的日期。如星期一对应了2,就减1天 temp_cal1.add(Calendar.DAY_OF_MONTH, -(temp_cal1.get(Calendar.DAY_OF_WEEK))+1);// System.out.println(temp_DateFormat.format(temp_cal1.getTime())); Calendar类里面有getFirstDayOfWeek() 缺少返回语句 【新手请教,请帮忙~】 为什么double类型9999999999999999.0,输出的是10000000000000000? 问题连锁! 25年了总算找到个MM肯做我GF了!放分庆祝:) 怎样包含一个同文件夹下的类? 高手救我,轉碼問題 appletviewer该如何使用?? How to deploy ear file with command line utility? 最简单的问题,JDK1。4。0的配置问题!!! java的编程环境? -sourcepath没有作用? System.out.println 和 System.err.println有什么不同
SimpleDateFormat temp_DateFormat = new SimpleDateFormat("yyyy-MM-dd");
Calendar temp_cal1 = Calendar.getInstance();
//只设置了年和周的field,生成的日历会以当前日期是星期几来设置日历的星期
temp_cal1.set(Calendar.YEAR, Integer.valueOf(this.ryear));
temp_cal1.set(Calendar.WEEK_OF_YEAR, Integer.valueOf(this.rweek));
//减去星期几对应的数字,就会得出该周第一日(即星期天)对应的日期。如星期一对应了2,就减1天
temp_cal1.add(Calendar.DAY_OF_MONTH, -(temp_cal1.get(Calendar.DAY_OF_WEEK))+1);//
System.out.println(temp_DateFormat.format(temp_cal1.getTime()));