Calendar cal = Calendar.getInstance();
SimpleDateFormat f1 =new SimpleDateFormat("yyyy");
SimpleDateFormat f2 =new SimpleDateFormat("MM");
SimpleDateFormat f3 =new SimpleDateFormat("dd");
Date date=new Date();
int year=Integer.valueOf(f1.format(date));
int month=Integer.valueOf(f2.format(date));
int day=Integer.valueOf(f3.format(date));
cal.set(Calendar.YEAR, year);
cal.set(Calendar.MONTH, month-1);
cal.set(Calendar.DAY_OF_MONTH, 1);
Date startOfMonth = cal.getTime();
cal.set(Calendar.DAY_OF_MONTH, day);
Date now =cal.getTime();
//给页面的输入框赋值
transQuery.setSettleDateFrom(DateUtil.dateToStr(startOfMonth,"yyyy-MM-dd"));
transQuery.setSettleDateTo(DateUtil.dateToStr(now,"yyyy-MM-dd"));
后台初始化日期传给前端jsp页面
最新推荐文章于 2022-10-21 09:57:54 发布