JDK8 LocalDateTime转换成时间戳

LocalDateTime localDateTime = LocalDateTime.now();
System.out.println(localDateTime);
//将localDateTime转换成时间戳    System.out.println("localDateTime:"+java.sql.Timestamp.valueOf(localDateTime).getTime());
//使用System获取时间戳
System.out.println("system:"+System.currentTimeMillis());

以上就是将LocalDateTime转换成时间戳的方式,方法很简单,参考:https://coderanch.com/t/651936/databases/Convert-java-time-LocalDateTime-SE

你可能感兴趣的:(小技巧)