Así se obtiene la marca de tiempo Unix actual en los principales lenguajes. La mayoría devuelve segundos (10 dígitos) o milisegundos (13 dígitos).
- JavaScript:
Math.floor(Date.now() / 1000)(segundos),Date.now()(milisegundos) - Python:
int(time.time()) - Java:
System.currentTimeMillis() / 1000L - PHP:
time() - Go:
time.Now().Unix() - Ruby:
Time.now.to_i - C#:
DateTimeOffset.UtcNow.ToUnixTimeSeconds() - Swift:
Int(Date().timeIntervalSince1970) - Bash:
date +%s - MySQL:
SELECT UNIX_TIMESTAMP()
Ten cuidado de no confundir los segundos con los milisegundos. Pega cualquier valor en el conversor de la parte superior del sitio para verlo como una fecha legible al instante.