// Current Unix seconds
const seconds = Math.floor(Date.now() / 1000);
// Current Unix milliseconds
const ms = Date.now();
// Seconds → Date
const d = new Date(seconds * 1000);
const now: number = Math.floor(Date.now() / 1000);
const iso: string = new Date(now * 1000).toISOString();
import time
seconds = int(time.time()) # Unix seconds
ms = int(time.time() * 1000) # Unix milliseconds
# Seconds → datetime
from datetime import datetime
dt = datetime.utcfromtimestamp(seconds)
import "time"
now := time.Now()
seconds := now.Unix() // Unix seconds
ms := now.UnixMilli() // Unix milliseconds
ns := now.UnixNano() // Unix nanoseconds
// Seconds → time
t := time.Unix(seconds, 0)
long seconds = Instant.now().getEpochSecond();
long ms = System.currentTimeMillis();
// Seconds → Instant
Instant t = Instant.ofEpochSecond(seconds);
#include <time.h>
time_t seconds = time(NULL); // Unix seconds
// Seconds → struct tm (UTC)
struct tm *utc = gmtime(&seconds);
#include <chrono>
using namespace std::chrono;
auto now = system_clock::now();
auto ms = duration_cast<milliseconds>(now.time_since_epoch()).count();
auto sec = duration_cast<seconds>(now.time_since_epoch()).count();
long seconds = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
long ms = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
// Seconds → DateTime
var dt = DateTimeOffset.FromUnixTimeSeconds(seconds).UtcDateTime;
$seconds = time(); // Unix seconds
$ms = (int)(microtime(true) * 1000); // Unix milliseconds
// Seconds → string
echo date('c', $seconds);seconds = Time.now.to_i # Unix seconds
ms = (Time.now.to_f * 1000).to_i
# Seconds → Time
t = Time.at(seconds)
use std::time::{SystemTime, UNIX_EPOCH};
let now = SystemTime::now().duration_since(UNIX_EPOCH).unwrap();
let seconds = now.as_secs();
let ms = now.as_millis();
let ns = now.as_nanos();let seconds = Date().timeIntervalSince1970 // Double
let ms = Int(Date().timeIntervalSince1970 * 1000)
// Seconds → Date
let d = Date(timeIntervalSince1970: seconds)
val seconds = System.currentTimeMillis() / 1000
val ms = System.currentTimeMillis()
// Seconds → Instant
val t = java.time.Instant.ofEpochSecond(seconds)
final seconds = DateTime.now().millisecondsSinceEpoch ~/ 1000;
final ms = DateTime.now().millisecondsSinceEpoch;
// Seconds → DateTime
final d = DateTime.fromMillisecondsSinceEpoch(seconds * 1000, isUtc: true);
# Unix seconds
seconds=$(date +%s)
# Unix milliseconds (GNU date)
ms=$(date +%s%3N)
# Seconds → ISO 8601 (GNU date)
date -u -d @"$seconds" +%Y-%m-%dT%H:%M:%SZ
my $seconds = time(); # Unix seconds
my $ms = int(Time::HiRes::time() * 1000); # Unix milliseconds
# Seconds → localtime
my @t = gmtime($seconds);
val seconds = System.currentTimeMillis() / 1000L
val ms = System.currentTimeMillis()
// Seconds → Instant
val t = java.time.Instant.ofEpochSecond(seconds)