Online timestamp conversion tool, support conversion between timestamp and date
Unix timestamp (Unix Timestamp) is defined as the total seconds from Greenwich Mean Time January 1, 1970 00:00:00 to the present. Timestamp is independent of specific time zones.
From 1986 to 1991, the People's Republic of China implemented daylight saving time nationwide for six years...
The start and end of daylight saving time are artificial interventions in the calendar by government orders...
In different versions, the daylight saving time start time of the Asia/Shanghai
time zone is different...
Language | Method to get timestamp (Unix timestamp) |
---|---|
Swift |
NSDate().timeIntervalSince1970 * 1000 //毫秒
|
Go |
import (
"time"
)
int32(time.Now().Unix())
|
Java |
// test 1
(int) (System.currentTimeMillis() / 1000)
// test 2
(int) (DateTime.now().getMillis() / 1000)
// test 3
new Date().getTime()
// test 4
Calendar.getInstance().getTimeInMillis();
|
JavaScript |
var timestamp = Date.parse(new Date());
var timestamp = (new Date()).valueOf();
var timestamp = new Date().getTime();
var timestamp = Math.round(new Date() / 1000)
|
Objective-C |
UInt64 recordTime = [[NSDate date] timeIntervalSince1970]*1000; //ms
|
MySQL |
SELECT unix_timestamp(now())
|
SQLite |
SELECT strftime('%s', 'now')
|
Erlang |
calendar:datetime_to_gregorian_seconds(calendar:universal_time())
-719528 * 24 * 3600.
|
PHP |
// pure php
time()
// Carbon\Carbon
Carbon::now()->timestamp
|
Python |
import time
time.time()
|
Ruby |
Time.now.to_i
|
Shell |
date +%s
|
Groovy |
(new Date().time / 1000).intValue()
|
Lua |
os.time()
|
.NET/C# |
(DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000
|