当前时间: 1734903407 2024-12-23 05:36:47
时区设置:
时间日期:
时间戳:
Java
java
time
JS
JavaScript
Math.round(new Date().getTime()/1000)
getTime()返回数值的单位是毫秒
C#
Microsoft .NET / C#
epoch = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000
Msql
MySQL
SELECT unix_timestamp(now())
PHP
php
time();
strtotime('now');
Perl
Perl
time
Psql
PostgreSQL
SELECT extract(epoch FROM now())
PY
Python
import time
time.time()
Rb
Ruby
获取Unix时间戳:Time.now 或 Time.new
显示Unix时间戳:Time.now.to_i
SQL
SQL Server
SELECT DATEDIFF(s, '1970-01-01 00:00:00', GETUTCDATE())
Sh
Linux Shell
date +%s
Java
java
String date = new java.text.SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(new java.util.Date(Unix timestamp * 1000))
JS
JavaScript
 var unixTimestamp = new Date(Unix timestamp * 1000)
commonTime = unixTimestamp.toLocaleString()
C#
Microsoft .NET / C#
DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
long lTime = long.Parse(timeStamp + "0000000");
TimeSpan toNow = new TimeSpan(lTime); return dtStart.Add(toNow);
Msql
MySQL
from_unixtime(Unix timestamp)
PHP
php
date('Y-m-d H:i:s', Unix timestamp)
Perl
Perl
my $time = Unix timestamp
my ($sec, $min, $hour, $day, $month, $year) = (localtime($time))[0,1,2,3,4,5,6]
Psql
PostgreSQL
SELECT TIMESTAMP WITH TIME ZONE 'epoch' + Unix timestamp) * INTERVAL '1 second';
PY
Python
import time
time.gmtime(Unix timestamp)
Rb
Ruby
Time.at(Unix timestamp)
SQL
SQL Server
DATEADD(s, Unix timestamp, '1970-01-01 00:00:00')
Sh
Linux Shell
date -d @Unix timestamp
Java
java
long epoch = new java.text.SimpleDateFormat("dd/MM/yyyy HH:mm:ss").parse("01/01/1970 01:00:00");
JS
JavaScript
var commonTime = new Date(Date.UTC(year, month - 1, day, hour, minute, second))
C#
Microsoft .NET / C#
DateTime DateStart= new DateTime(1970,1,1,8,0,0);
return Convert.ToInt32((DateTime.Now - DateStart).TotalSeconds);
Msql
MySQL
SELECT unix_timestamp(time)
时间格式: YYYY-MM-DD HH:MM:SS 或 YYMMDD 或 YYYYMMDD
PHP
php
mktime(hour, minute, second, month, day, year)
Perl
Perl
use Time::Local
my $time = timelocal($sec, $min, $hour, $day, $month, $year);
Psql
PostgreSQL
SELECT extract(epoch FROM now())
PY
Python
import time
int(time.mktime(time.strptime('YYYY-MM-DD HH:MM:SS', '%Y-%m-%d %H:%M:%S')))
Rb
Ruby
Time.local(year, month, day, hour, minute, second)
SQL
SQL Server
SELECT DATEDIFF(s, '1970-01-01 00:00:00', time)
Sh
Linux Shell
date +%s -d"Jan 1, 1970 00:00:01"