Unix时间戳
当前时间
Unix时间戳
北京时间
在编程语言中获取Unix时间戳:
语言 | 秒 |
---|---|
JavaScript | Math.round(new Date().getTime() / 1000) |
Java | System.currentTimeMillis() / 1000 |
Python | int(time.time()) |
Go | time.Now().Unix() |
PHP | time() |
Ruby | Time.now.to_i |
C# | DateTimeOffset.UtcNow.ToUnixTimeSeconds() |
Swift | NSDate().timeIntervalSince1970 |
Objective-C | [[NSDate date] timeIntervalSince1970] |