<nav id="auuga"><nav id="auuga"></nav></nav><menu id="auuga"><tt id="auuga"></tt></menu>
  • <menu id="auuga"></menu>

    產品中心 業內新聞 案例中心 視頻中心

    各種程序處理Unix時間戳(Unix timestamp)方法 各種程序處理Unix時間戳(Unix timestamp)方法

    各種程序處理Unix時間戳(Unix timestamp)方法

    分類:業內新聞 396

    編程程序獲取當前時間Unix時間戳(Unix timestamp)方法

    Java time
    JavaScript Math.round(new Date().getTime()/1000)
    getTime()返回數值的單位是毫秒
    Unix / Linux date +%s
    Microsoft .NET / C# epoch = (DateTime.Now.ToUniversalTime().Ticks – 621355968000000000) / 10000000
    Python 1) import time? ? 2) time.time()
    Perl time
    PHP time()
    MySQL SELECT unix_timestamp(now())
    PostgreSQL SELECT extract(epoch FROM now())
    SQL Server SELECT DATEDIFF(s, ‘1970-01-01 00:00:00’, GETUTCDATE())
    Ruby 獲取 Unix時間戳:Time.now? ? or? ?Time.new
    顯示 Unix時間戳:Time.now.to_i
    VBScript / ASP DateDiff(“s”, “01/01/1970 00:00:00”, Now())

     

    編程程序賦值時間變量為Unix時間戳(Unix timestamp)方法

    Java String date = new java.text.SimpleDateFormat(“dd/MM/yyyy HH:mm:ss”).format(new java.util.Date(Unix timestamp * 1000))
    JavaScript 先 var unixTimestamp = new Date(Unix timestamp * 1000) 然后 commonTime = unixTimestamp.toLocaleString()
    Linux date -d @Unix timestamp
    Perl 1)my $time = Unix timestamp? 2)my ($sec, $min, $hour, $day, $month, $year) = (localtime($time))[0,1,2,3,4,5,6]
    PHP date(‘r’, Unix timestamp)
    MySQL from_unixtime(Unix timestamp)
    PostgreSQL SELECT TIMESTAMP WITH TIME ZONE ‘epoch’ + Unix timestamp) * INTERVAL ‘1 second’;
    Python 1) import time? ? 2) time.gmtime(Unix timestamp)
    SQL Server DATEADD(s, Unix timestamp, ‘1970-01-01 00:00:00’)
    Ruby Time.at(Unix timestamp)
    VBScript / ASP DateAdd(“s”, Unix timestamp, “01/01/1970 00:00:00”)
    標簽:新聞 上一篇: 下一篇:
    展開更多
    預約軟件體驗

    loading...

    亚洲国产成人久久综合碰