JAVA date处理

    Date now=new Date();
			Long nowTime=now.getTime();
			Long monthAgo=nowTime-1000*60*60*24*30L;//不加L不行...还得基本功好啊
			Calendar cal=Calendar.getInstance();
			cal.setTimeInMillis(monthAgo);
			
			SimpleDateFormat smf=new SimpleDateFormat("yyyy-MM-dd");
			end=smf.format(now);
			start=smf.format(cal.getTime());

你可能感兴趣的:(calendar)