日期:2014-05-19  浏览次数:20786 次

java 怎么把41012.623599537 转换成 “yyyy-MM-dd hh:mm:ss”
求答案

------解决方案--------------------
Java code

double d1 = 41012.623599537;
        Calendar base = Calendar.getInstance();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd ");
        SimpleDateFormat outFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        base.setTime(format.parse("1899-12-30 "));
        base.add(Calendar.DATE, (int) d1);
        base.add(Calendar.MILLISECOND, (int) ((d1 % 1) * 24 * 60 * 60 * 1000));
        System.out.println("Time=" + outFormat.format(base.getTime()));