N-Tool
轻量而充实的在线工具
| 语言 | 方法 |
|---|---|
| Swift |
NSDate().timeIntervalSince1970
|
| Go |
import (
|
| Java |
// pure java
// joda java
|
| JavaScript |
Math.round(new Date() / 1000)
|
| Object-C |
[[NSDate date] timeIntervalSince1970]
|
| MySQL |
SELECT unix_timestamp(now())
|
| SQLite |
SELECT strftime('%s', 'now')
|
| Erlang |
calendar:datetime_to_gregorian_seconds(calendar:universal_time())-719528*24*3600.
|
| PHP |
<?php
<?php
|
| Python |
import time
import arrow
|
| Ruby |
Time.now.to_i
|
| Shell |
date +%s
|
| Groovy |
(new Date().time / 1000).longValue()
|
| Lua |
(new Date().time / 1000).longValue()
|
| .NET/C# |
(DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000
|
| Dart |
(new DateTime.now().millisecondsSinceEpoch / 1000).truncate()
|