现在的Unix时间戳(Unix timestamp)是:1578817959开始停止刷新

时间戳编程

语言 Unix时间戳 Unix时间戳转time time转Unix时间戳
Java time String date = new java.text.SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(new java.util.Date(Unix timestamp * 1000)) long epoch = new java.text.SimpleDateFormat("dd/MM/yyyy HH:mm:ss").parse("01/01/1970 01:00:00");
JavaScript Math.round(new Date().getTime()/1000)
getTime()返回数值的单位是毫秒
var unixTimestamp = new Date(Unix timestamp * 1000)
commonTime = unixTimestamp.toLocaleString()
var commonTime = new Date(Date.UTC(year, month - 1, day, hour, minute, second))
Microsoft .NET / C# epoch = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000 public static DateTime _GetDateTime(long unixTime)
{
return (new DateTime(1970, 1, 1)).AddSeconds(unixTime).ToLocalTime();
}
public static long _GetUnixTime(DateTime time)
{
return (time.ToUniversalTime().Ticks / 10000000 - 62135596800);
}
MySQL SELECT unix_timestamp(now()) from_unixtime(Unix timestamp) SELECT unix_timestamp(time)
时间格式: YYYY-MM-DD HH:MM:SS 或 YYMMDD 或 YYYYMMDD
Perl time my $time = Unix timestamp
my ($sec, $min, $hour, $day, $month, $year) = (localtime($time))[0,1,2,3,4,5,6]
use Time::Local
my $time = timelocal($sec, $min, $hour, $day, $month, $year);
PHP time() date('r', Unix timestamp) mktime(hour, minute, second, month, day, year)
PostgreSQL SELECT extract(epoch FROM now()) SELECT TIMESTAMP WITH TIME ZONE 'epoch' + Unix timestamp) * INTERVAL '1 second'; SELECT extract(epoch FROM date('YYYY-MM-DD HH:MM:SS'));
Python import time
time.time()
import time
time.gmtime(Unix timestamp)
import time
int(time.mktime(time.strptime('YYYY-MM-DD HH:MM:SS', '%Y-%m-%d %H:%M:%S')))
Ruby 获取Unix时间戳:Time.now 或 Time.new
显示Unix时间戳:Time.now.to_i
Time.at(Unix timestamp) Time.local(year, month, day, hour, minute, second)
SQL Server SELECT DATEDIFF(s, '1970-01-01 00:00:00', GETUTCDATE()) DATEADD(s, Unix timestamp, '1970-01-01 00:00:00') SELECT DATEDIFF(s, '1970-01-01 00:00:00', time)
Unix / Linux date +%s date -d @Unix timestamp date +%s -d"Jan 1, 1970 00:00:01"
VBScript / ASP DateDiff("s", "01/01/1970 00:00:00", Now()) DateAdd("s", Unix timestamp, "01/01/1970 00:00:00") DateDiff("s", "01/01/1970 00:00:00", time)
您的足迹: