标签:java 日期格式
public String progressbarDay(String pid) throws Exception { FinanceProject fp = (FinanceProject)baseDao.selectOne("jz.finance.getFinanceProjectById",pid); double sday = (fp.getEndDate().getTime()-fp.getStartDate().getTime())/(24*60*60*1000);//两个日期之间的天数,即总天数 double nday = (new Date().getTime()-fp.getStartDate().getTime())/(24*60*60*1000);//开始时间-现在的时间 = 项目已开始时间 return DecimalFormat((nday/sday)*100); } public String progressbarMoney(String pid) throws Exception { FinanceProject fp = (FinanceProject) baseDao.selectOne("jz.finance.getFinanceProjectById",pid); Map<String, Object> map = new HashMap<String,Object>(); map.put("project", pid); FinanceReserve fr = (FinanceReserve) baseDao.selectOne("getFinanceReserveForProjectListPay",map); double money = (fr.getNum()*Double.parseDouble(fp.getOnePrice()));//已经筹集到的金额 return DecimalFormat((money/Double.parseDouble(fp.getMoney()))*100); } //四舍五入保留小数点2位 private String DecimalFormat(double number){ String ret = null; try { DecimalFormat df = new DecimalFormat("#.00"); ret = df.format(number).toString(); } catch (Exception e) { e.printStackTrace(); } return ret; }
标签:java 日期格式
原文地址:http://alex233.blog.51cto.com/8904951/1758523