时间戳通常是一个long数据(注意java中赋值时需要带上L标识是long整型,否则int过长报错)
代码实现
常用工具类:
- java.util.Date
- java.time.Instant
- java.time.format.DateTimeFormatter
toInstant() 方法的功能是将一个 Date 对象转换为 Instant 对象。这个方法基于 java.util.Date 的 getTime() 方法,该方法返回从1970年1月1日00:00:00 UTC到此 Date 对象表示的时间的毫秒数。
 
 从给定的毫秒数创建一个 Instant 对象,以1970年1月1日00:00:00 UTC为起点计算。
 
 工具网站
支持单个和批量转换长整型的时间戳。
时间戳(Unix timestamp)转换工具 - 在线工具Unix时间戳转换可以把Unix时间转成北京时间 https://tool.lu/timestamp/
https://tool.lu/timestamp/
Translate Human time format to Epoch time format https://www.epochconverter.com/
https://www.epochconverter.com/