计算机时间戳转换时间在线,时间戳,Unix时间戳,时间戳转换

2cb266a47f501c9e3e5e6519d68b44ef.png

1. System.currentTimeMillis() / 1000 [ 最快 ]

2. new Date().getTime() / 1000

3. Calendar.getInstance().getTimeInMillis() / 1000

点击查看测试结果

JavaScript

Math.round(new Date().getTime()/1000)

Math.round(+new Date() / 1000)

Math.round(Date.now() / 1000) [ 其实都是一种方法 ]

Microsoft .NET / C#

label1.text = datetime.now.hour.tostring() + ':' +datetime.now.minute.tostring() + ':' +datetime.now.second.tostring()。return hkclient.hiks_grabpic(playsession,system.datetime.now.date.tostring() + system.datetime.now.minute.tostring() + system.datetime.now.second.tostring() + ra.next().tostring(), 0)。}unityengine.random.seed = (int)system.datetime.now.touniversaltime().tobinary()。

MySQL

SELECT unix_timestamp(now())

time()

PostgreSQL

7fa1daeee3721a6be6bbf404388ab1e3.png

SELECT extract(epoch FROM now())

Python

先 import time 然后 time.time()

获取Unix时间戳:Time.now 或 Time.new

显示Unix时间戳:Time.now.to_i

SQL Server

SELECT DATEDIFF(s, '1970-01-01 00:00:00', GETUTCDATE())

Unix / Linux

date +%s

VBScript / ASP

DateDiff("s", "01/01/1970 00:00:00", Now())

Swift

NSDate().timeIntervalSince1970

import (

ffd498ec7792d80d8674e9a21db01271.png

"time"

)

int32(time.Now().Unix())

其他操作系统

(如果Perl被安装在系统中)

命令行状态:perl -e "print time"

String date = new java.text.SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(new java.util.Date(Unix timestamp * 1000))

JavaScript

var timestamp = new date().gettime()。var n=(endtime-new date().gettime())/1000。var date = new date()。

Linux

date -d @Unix timestamp

MySQL

from_unixtime(Unix timestamp)

min hour day month year command。a min hour day month year command。d command year month day hour min。

2d20b5d8df5498fbeeb47656daab70ed.gif

date('r', Unix timestamp)

PostgreSQL

SELECT TIMESTAMP WITH TIME ZONE 'epoch' + Unix timestamp) * INTERVAL '1 second';

Python

先 import time 然后 time.gmtime(Unix timestamp)

Time.at(Unix timestamp)

SQL Server

DATEADD(s, Unix timestamp, '1970-01-01 00:00:00')

VBScript / ASP

DateAdd("s", Unix timestamp, "01/01/1970 00:00:00")

其他操作系统

(如果Perl被安装在系统中)

$ perl -e "say scalar reverse 'hello'"。before starting, check that your perl version is at least 5.005_03 (or higher) by running the perl -v command. if not,you can install a recent perl interpreter from activeperl (win32) or perl.com (unix/linux/other).。1lunix 时间戳,-e可以让perl程序在perl命令行上运行。

long epoch = new java.text.SimpleDateFormat("dd/MM/yyyy HH:mm:ss").parse("01/01/1970 01:00:00");

170224-1004.jpg

JavaScript

var commonTime = new Date(Date.UTC(year, month - 1, day, hour, minute, second))

MySQL

SELECT unix_timestamp(time)

时间格式: YYYY-MM-DD HH:MM:SS 或 YYMMDD 或 YYYYMMDD

先 use Time::Local 然后 my $time = timelocal($sec, $min, $hour, $day, $month,$year);

mktime(hourlunix 时间戳, minute, second, month, day, year)

PostgreSQL

string date = new simpledateformat("yyyy-mm-dd hh:mm:ss").format(new date())。 if (date.length() > 10) { sdf = new simpledateformat("yyyy-mm-dd hh:mm:ss")。3 $date.format('yyyy-mm-dd hh:mm:ss',$order.createtime,$locale)

Python

先 import time 然后 int(time.mktime(time.strptime('YYYY-MM-DD HH:MM:SS', '%Y-%m-%d %H:%M:%S')))

Time.local(year, month, day, hour, minute, second)

SQL Server

SELECT DATEDIFF(s, '1970-01-01 00:00:00', time)

Unix / Linux

date +%s -d"Jan 1, 1970 00:00:01"

VBScript / ASP

DateDiff("s", "01/01/1970 00:00:00", time)

本文来自电脑杂谈,转载请注明本文网址:

http://www.pc-fly.com/a/ruanjian/article-117328-1.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值