今天遇到 默认在jsp页面显示 当月的数据, 查询条件限制 有时间 ,
以下是如何获得 当月第一天 00:00:00的数据
SimpleDateFormat df1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = new Date();
Date da = new Date(date.getYear(),date.getMonth(),01);
startTime=Timestamp.valueOf(df1.format(da));
经过以上代码:
如获得这个月的第一天的 时间为:
2009-12-02 00:00:00
//获取下月
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").for