从格林尼治时间1970年1月1日0时0分0秒算起(北京时间1970年1月1日8时0分0秒), 开始计算时间戳
一年31536000秒,时间戳最多纪录 9999999999秒, 9999999999/31536000 ≈ 317 年, 10位的时间戳大约可以使用317年, 1970+317=2287年,也就是2286年就要考虑变更到11位时间戳了
如果精确计算一下(考虑闰年)
2286年11月21日1时46分39秒
5138年11月16日17时46分39秒
33658年09月27日9时46分39秒
import time
# 获取时间戳
timestamp = int(time.time())
print(timestamp)
# 将时间戳转换为结构化时间格式
struct_time = time.localtime(timestamp)
print(struct_time)
// 获取毫秒时间戳(13位)
let timestamp = new Date().getTime();
console.log(timestamp);
// 将毫秒时间戳转换为结构化时间格式
let struct_time = new Date(timestamp);
console.log(struct_time);