excel读取时间格式错误的解决

当读取excel的时间格式时会为double形式,这里可以进行一轮转换

    /**
     * 时间格式的转换和判断
     *
     * @param date
     * @return
     */
    public String changeString(String date, StringBuilder stringBuilder) {
//        String newDate = toDate(date).replace("年", "-").replace("月", "-").substring(0, date.length() - 1);
//正则表达式
        Pattern pattern = Pattern.compile(floatExpression1);
        Matcher matcher = pattern.matcher(date);
        if (matcher.matches()) {
            String newDate = toDate(Double.parseDouble(date), "yyyy-MM-dd");
            return newDate;
        } else {
            stringBuilder.append("出货时间格式错误");
            return null;
        }
    }
发布了33 篇原创文章 · 获赞 0 · 访问量 1459

猜你喜欢

转载自blog.csdn.net/m0_46086429/article/details/104281809
今日推荐