读书人

JAVA date处置

发布时间: 2012-10-28 09:54:44 作者: rapoo

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());

读书人网 >编程

热点推荐