Time & security

Unix Timestamp Converter

Convert between Unix timestamps and dates with time zone support and batch conversion.

Runs locally in your browser
Current timestamp
0

Timestamp → date and time

Date and time → timestamp

Batch conversion

One timestamp per line. Spaces, commas and semicolons also work.

About timestamps

What a timestamp is

A Unix timestamp counts the seconds since 1970-01-01 00:00:00 UTC, ignoring leap seconds. It describes an absolute instant and has no time zone; a time zone is only needed to render it as a clock reading.

Seconds or milliseconds

Precision differs between stacks: Unix tools and most HTTP APIs use seconds, while Date.now() in JavaScript and currentTimeMillis() in Java use milliseconds. The 1000x gap shifts dates by decades, so confirm the unit first.

Get the current timestamp in each language

JavaScript
Math.floor(Date.now() / 1000)
TypeScript
Math.floor(new Date().getTime() / 1000)
Python
import time
int(time.time())
Java
Instant.now().getEpochSecond()
Go
time.Now().Unix()
Rust
SystemTime::now()
  .duration_since(UNIX_EPOCH)?
  .as_secs()
PHP
time()
Ruby
Time.now.to_i
C
#include <time.h>
time_t now = time(NULL);
C#
DateTimeOffset.UtcNow.ToUnixTimeSeconds()
Swift
Int(Date().timeIntervalSince1970)
Kotlin
System.currentTimeMillis() / 1000
Shell
date +%s
MySQL
SELECT UNIX_TIMESTAMP(NOW())
SQLite
SELECT strftime('%s', 'now')
Lua
os.time()

Daylight saving and time zone data

Time zone offsets change by legislation rather than staying fixed. China observed daylight saving from 1986 to 1991, so historical instants in Asia/Shanghai have a UTC+09:00 offset. Browsers and runtimes rely on their own time zone database (tzdata) to apply such rules, which is why the same timestamp can render differently across JDK versions or operating systems. This page uses the time zone database built into your browser.

How it works

Convert between Unix timestamps and dates both ways, with seconds/milliseconds, time zone selection, batch conversion and a live clock.

CodeTK does not upload, store, or analyze tool input. Any saved draft remains in this browser only.