您好,欢迎来到六九路网。
搜索
您的当前位置:首页yyyyMMdd转换成yyyy-MM-dd

yyyyMMdd转换成yyyy-MM-dd

来源:六九路网

@Test
    public  void time1(){
        try {
            String str = "20200828";
            SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
            formatter.setLenient(false);
            Date newDate= formatter.parse(str);
            formatter = new SimpleDateFormat("yyyy-MM-dd");
            System.out.println(formatter.format(newDate));
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }
    输出结果为:2020-08-28

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- 69lv.com 版权所有 湘ICP备2023021910号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务