时间戳在线转换

  • UNIX 时间戳是从 1970 年 1 月 1 日 00:00:00 到现在的总秒数,与时区无关。
  • 当前 UNIX 时间戳(基于浏览器时间):1729585721

各编程语言中获取时间戳的方法

SwiftNSDate().timeIntervalSince1970
Goimport ( "time" )
int32(time.Now().Unix())
Java(int) (System.currentTimeMillis() / 1000)
JavaScriptMath.round(new Date() / 1000)
Objective-C[[NSDate date] timeIntervalSince1970]
MySQLSELECT unix_timestamp(now())
SQLiteSELECT strftime('%s', 'now')
PHPtime()
Pythonimport time
time.time()
RubyTime.now.to_i
Shelldate +%s
Groovy(new Date().time / 1000).intValue()
Luaos.time()
.NET/C#(DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000