/**
     * 字符串转日期格式
     * */
    public static Date date(String date_str) {
        try {
            Calendar zcal = Calendar.getInstance();
            Timestamp timestampnow = new Timestamp(zcal.getTimeInMillis());
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
            ParsePosition pos = new ParsePosition(0);
            java.util.Date current = formatter.parse(date_str, pos);
            timestampnow = new Timestamp(current.getTime());
            return timestampnow;
        }
        catch (NullPointerException e) {
            return null;
        }
    }

 

相关文章:

  • 2021-12-12
  • 2021-11-25
  • 2021-07-09
  • 2022-02-08
猜你喜欢
  • 2021-11-27
  • 2021-11-27
  • 2021-10-16
  • 2022-12-23
  • 2022-02-08
  • 2021-08-14
相关资源
相似解决方案