JAVA 日期相关API(JDK 8 之前)

 

 

 

 

 

 

 

 

 

 

        String bir = "2020-02-02";
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date date = null;
        try {
            date = sdf.parse(bir);
            java.sql.Date birDate = new java.sql.Date(date.getTime());
            System.out.println(birDate);
        } catch (ParseException e) {
            e.printStackTrace();
        }

 

posted @ 2020-02-13 15:51  超级学渣渣  阅读(151)  评论(0编辑  收藏  举报