Developer
Unix Timestamp Converter
Convert Unix seconds, milliseconds, and readable dates, with common code snippets for developers.
- Current seconds
1783329855- Current milliseconds
1783329855125- Local time
2026/7/6 17:24:15- UTC time
Mon, 06 Jul 2026 09:24:15 GMT
Code
Timestamp snippets
| Language | Get current Unix seconds | Copy |
|---|---|---|
| JavaScript | Math.floor(Date.now() / 1000) | |
| TypeScript | const unixSeconds: number = Math.floor(Date.now() / 1000) | |
| C | time_t unix_seconds = time(NULL); | |
| C++ | auto unix_seconds = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); | |
| Python | int(time.time()) | |
| Java | Instant.now().getEpochSecond() | |
| Swift | Int(Date().timeIntervalSince1970) | |
| Objective-C | (NSInteger)[[NSDate date] timeIntervalSince1970] | |
| PHP | time() | |
| Go | time.Now().Unix() | |
| C# | DateTimeOffset.UtcNow.ToUnixTimeSeconds() | |
| Kotlin | Instant.now().epochSecond | |
| MySQL | UNIX_TIMESTAMP() | |
| PostgreSQL | EXTRACT(EPOCH FROM NOW())::bigint | |
| Shell | date +%s |
FAQ
Questions people ask
What is a Unix timestamp?
It is the number of seconds elapsed since 1970-01-01 00:00:00 UTC. Some systems use milliseconds instead of seconds.
How does the tool detect seconds or milliseconds?
Values with 13 or more digits are treated as milliseconds. Shorter numeric values are treated as seconds.
Why do local time and UTC time differ?
Unix timestamps are timezone independent, but human-readable dates are displayed in either your local timezone or UTC.
Related tools