SimpleDateFormat sdf = new SimpleDateFormat(“yyyy-MM-dd”);
Date dateStart;
try {
dateStart = sdf.parse(DATE_START);
Calendar c = Calendar.getInstance();
c.setTime(dateStart);//设置日历时间
param.put(“DATE_START”,DATE_START );//积分有效期起
String valid = validMap.get(“VALID”)+””;//积分有效期
if(“0”.equals(valid)){
param.put(“DATE_END”, “”);
}else if(“6”.equals(valid)){
c.add(Calendar.MONTH,6);
param.put(“DATE_END”, sdf.format(c.getTime()));
}else if(“12”.equals(valid)){
c.add(Calendar.MONTH,12);
param.put(“DATE_END”, sdf.format(c.getTime()));
}else if(“24”.equals(valid)){
c.add(Calendar.MONTH,24);
param.put(“DATE_END”, sdf.format(c.getTime()));
}
} catch (ParseException e) {
e.printStackTrace();
}
Date dateStart;
try {
dateStart = sdf.parse(DATE_START);
Calendar c = Calendar.getInstance();
c.setTime(dateStart);//设置日历时间
param.put(“DATE_START”,DATE_START );//积分有效期起
String valid = validMap.get(“VALID”)+””;//积分有效期
if(“0”.equals(valid)){
param.put(“DATE_END”, “”);
}else if(“6”.equals(valid)){
c.add(Calendar.MONTH,6);
param.put(“DATE_END”, sdf.format(c.getTime()));
}else if(“12”.equals(valid)){
c.add(Calendar.MONTH,12);
param.put(“DATE_END”, sdf.format(c.getTime()));
}else if(“24”.equals(valid)){
c.add(Calendar.MONTH,24);
param.put(“DATE_END”, sdf.format(c.getTime()));
}
} catch (ParseException e) {
e.printStackTrace();
}
版权声明:本文为Marjorie_Sha原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。