Here is how to get the current Unix timestamp in major languages. Most return seconds (10 digits) or milliseconds (13 digits).
- JavaScript —
Math.floor(Date.now() / 1000)(seconds),Date.now()(milliseconds) - 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()
Be careful not to confuse seconds with milliseconds. Paste any value into the converter at the top of the site to see it as a human-readable date instantly.