方便快捷的标准时间和Unix timestamp时间戳转换工具,在线时间戳互转。
语言名 | 取时间戳的函数/方法 |
---|---|
Java | time |
PHP | time() |
JavaScript | Math.round(new Date().getTime()/1000) |
MySQL | SELECT unix_timestamp(now()) |
PostgreSQL | SELECT extract(epoch FROM now()) |
SQLite | SELECT strftime('%s', 'now'); |
SQL Server | SELECT DATEDIFF(s, '1970-01-01 00:00:00', GETUTCDATE()) |
Python | first import time, then time.time() |
Microsoft .NET / C# | epoch = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000 |
Golang | time.Now().Unix() |
Perl | time |
Ruby | Time.now or Time.new |
Lua | epoch = os.time([date]) |
R | as.numeric(Sys.time()) |
PowerShell | [int][double]::Parse((Get-Date (get-date).touniversaltime() -UFormat %s)) |
Unix / Linux | date +%s |
VBScript / ASP | DateDiff("s", "01/01/1970 00:00:00", Now()) |
C / C++ | time(NULL) |
Objective-C | [[NSDate date] timeIntervalSince1970] |
Swift | now.timeIntervalSince1970 |
Delphi | DateTimeToUnix(Now) |
2010-2024 900查询 版权所有