Logo

Programming-Idioms

Assign to t the number of milliseconds elapsed since 00:00:00 UTC on 1 January 1970.
New implementation

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
#include <chrono>
auto t = std::chrono::milliseconds(std::chrono::system_clock::now().time_since_epoch()).count();
import "time"
t := time.Now().UnixMilli()
import static java.lang.System.currentTimeMillis;
long t = currentTimeMillis();
import java.util.Date;
long t = new Date().getTime();
import java.time.Instant;
long t = Instant.now().toEpochMilli();
dateutils
t := DateTimeToUnix(Now);
use Time::HiRes;
$t = Time::HiRes::time * 1000;
import time
t = time.time() * 1000
t = 1000 * Time.now.to_f