当前日期时间:,时间戳:
Go | int32(time.Now().Unix()) |
---|---|
Java | System.currentTimeMillis() / 1000 |
JavaScript | Math.round(new Date().getTime()/1000) |
Microsoft .NET / C# | epoch = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000 |
MySQL | SELECT unix_timestamp(now()) |
Perl | time |
PHP | time() |
PostgreSQL | SELECT extract(epoch FROM now()) |
Python | time.time() |
Ruby | 获取Unix时间戳:Time.now 或 Time.new; 显示Unix时间戳:Time.now.to_i |
SQL Server | SELECT DATEDIFF(s, '1970-01-01 00:00:00', GETUTCDATE()) |
Unix / Linux | date +%s |
Swift | NSDate().timeIntervalSince1970 |
Objective-C | [[NSDate date] timeIntervalSince1970] |
Lua | os.time() |
VBScript / ASP | DateDiff("s", "01/01/1970 00:00:00", Now()) |
其他操作系统命令行 | perl -e "print time" |