Conversion between Timestamp and String

Examples of conversion between Timestamp and String types:

      String str = "2018-05-06 10:30:40";
      //String 转 Timestamp
      Timestamp time = Timestamp.valueOf(str);
       //Timestamp 转 String
       String strn = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(time);

Guess you like

Origin blog.csdn.net/wujian_csdn_csdn/article/details/105555252