Come ottenere l'ora Unix attuale in diversi linguaggi di programmazione?
import time# Get the current timestampcurrent_timestamp = int(time.time())
// get the current timestampvar currentTimestamp = Math.floor(Date.now() / 1000);
long currentTimestamp = System.currentTimeMillis() / 1000;
long currentTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
#include <iostream>#include <chrono>int main() {auto now = std::chrono::system_clock::now();auto now_ms = std::chrono::time_point_cast<std::chrono::milliseconds>(now);auto epoch = now_ms.time_since_epoch();auto value = std::chrono::duration_cast<std::chrono::seconds>(epoch);std::cout << value.count() << std::endl;return 0;}
<?php$currentTimestamp = time();echo $currentTimestamp;?>
const currentTimestamp = Math.floor(Date.now() / 1000);
let currentTimestamp = Int(Date().timeIntervalSince1970)
current_timestamp = Time.now.to_i
package mainimport ("fmt""time")func main() {currentTimestamp := time.Now().Unix()fmt.Println(currentTimestamp)}