Timestamp转化为String:
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//定义格式,不显示毫秒
Timestamp now = new Timestamp(System.currentTimeMillis());//获取系统当前时间
String str = df.format(now);
 
String转化为Timestamp:
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String time = df.format(new Date());
Timestamp ts = Timestamp.valueOf(time);

相关文章:

  • 2022-12-23
  • 2021-12-26
  • 2022-01-29
  • 2021-06-17
  • 2021-12-06
  • 2021-11-19
猜你喜欢
  • 2022-12-23
  • 2021-05-23
  • 2022-02-23
  • 2022-12-23
  • 2022-01-06
  • 2022-12-23
  • 2022-01-13
相关资源
相似解决方案