Date Time String Format turn

    /**
     * 字符串时间格式转 Date 格式
     * @param strDate
     * @return
     */
    public static Date getDateTimeByStringTime(String strDate) {
        //如果参数为空,直接返回
        if(strDate == null){ return null; }
        //
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        ParsePosition pos = new ParsePosition(0);
        //
        return formatter.parse(strDate, pos);
    }

Guess you like

Origin blog.csdn.net/xianhenyuan/article/details/92679341