java月份时间(第一天,最后一天)
<%//当前月的最后一天 cal.add( cal.MONTH,1 ); cal.set(cal.DATE,1); cal.add(cal.DATE,-1); java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("yyyy-MM-dd"); String day_end=df.format(cal.getTime());//当前月的第一天 GregorianCalendar gc = (GregorianCalendar) Calendar.getInstance(); gc.setTime(date); gc.set(Calendar.DAY_OF_MONTH, 1);String day_first = df.format(gc.getTime());//out.println(day_first);//获取下月Calendar calendar = Calendar.getInstance();calendar.setTime(new Date());calendar.add(Calendar.MONTH, 1);Date theDate = calendar.getTime();String strDateDay = new SimpleDateFormat("MM").format(theDate);int int_strDateDay = Integer.parseInt(strDateDay);String ttt = new SimpleDateFormat("yyyy-MM-dd").format(theDate);String worktime = new SimpleDateFormat("yyyyMM").format(theDate);//下月的第一天gc.setTime(theDate);gc.set(Calendar.DAY_OF_MONTH, 1);String day_first_nextM = df.format(gc.getTime());//下月的最后一天calendar.add( cal.MONTH,1 ); calendar.set(cal.DATE,1); calendar.add(cal.DATE,-1); String day_end_nextM=df.format(calendar.getTime());%> 1 楼 laoliu.org 2008-06-13 要是稍微整理一下成一个健全类就更好了,呵呵。我把它转到IT民工棚去了,http://mingongpeng.com,希望博主不要介意哈,呵呵。
另外看楼主的名字是日语,可以去棚子坐坐哈,主要是对日软件这块的人比较多。