后台初始化日期传给前端jsp页面

来源:互联网 发布:三国乱世挂机软件 编辑:程序博客网 时间:2024/05/16 07:52
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"));

0 0
原创粉丝点击