Online Tools Toolshu.com Log In Sign Up

Unix Timestamp Converter

Timezone/Country/Region:

Current Timestamp (ms):

1. Timestamp →

2. → Timestamp

Conversion Result:

Tool Introduction

Unix Timestamp Converter is a free online tool designed for developers and general users. It supports bidirectional conversion between Unix timestamps and human-readable date/time formats, with support for over 200 global timezones to meet the needs of international development and data processing.


What Is a Timestamp?

A Unix timestamp represents the total number of seconds (or milliseconds) elapsed since the Unix epoch — January 1, 1970, 00:00:00 UTC. Due to its precision and universality, timestamps are widely used in computer systems, database records, log analysis, API parameters, and more.


Core Features

  • Timestamp → Date/Time: Enter a Unix timestamp in seconds or milliseconds to instantly convert it to a readable date/time format. Auto-detection of the unit is supported.
  • Date/Time → Timestamp: Enter a specific date and time to get the corresponding Unix timestamp in seconds or milliseconds.
  • Live Current Timestamp: The page displays the current millisecond-level timestamp in real time, with a one-click copy button.
  • Global Timezone Support: Over 200 standard IANA timezones are built in, covering Asia, Europe, the Americas, Africa, Oceania, and more.

Use Cases

  • Frontend/backend debugging: Quickly verify whether the timestamp returned by an API is correct.
  • Database operations: Convert stored timestamp fields into readable dates for troubleshooting.
  • Log analysis: Decode Unix timestamps in system logs to trace when events occurred.
  • Cross-timezone collaboration: Confirm the local time representation of the same moment across different regions.

Get Current Timestamp by Language

The following code snippets show how to get the current Unix timestamp in popular programming languages:

Swift
NSDate().timeIntervalSince1970
Go
import (
"time"
)
int32(time.Now().Unix())
Java
// pure java
(int) (System.currentTimeMillis() / 1000)
// joda
(int) (DateTime.now().getMillis() / 1000)
JavaScript
Math.round(new Date() / 1000)
Objective-C
[[NSDate date] timeIntervalSince1970]
MySQL
SELECT unix_timestamp(now())
SQLite
SELECT strftime('%s', 'now')
Erlang
calendar:datetime_to_gregorian_seconds(calendar:universal_time())-719528*24*3600.
PHP
// pure php
time()
// Carbon\Carbon
Carbon::now()->timestamp
Python
import time
time.time()
Ruby
Time.now.to_i
Shell
date +%s
Groovy
(new Date().time / 1000).intValue()
Lua
os.time()
.NET/C#
(DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000
Rust
use std::time::{SystemTime, UNIX_EPOCH};
SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs()
Kotlin
System.currentTimeMillis() / 1000

Frequently Asked Questions

What is the difference between a second-level and millisecond-level timestamp?

A second-level timestamp (10 digits) has a precision of 1 second, while a millisecond-level timestamp (13 digits) has a precision of 1 millisecond. The tool supports automatic unit detection, or you can switch manually.


Does the timezone selection affect the conversion result?

The timestamp itself is an absolute global value independent of timezone. The timezone setting only affects how the result is displayed as a local date and time — for example, the same timestamp shows different hours in Beijing (UTC+8) versus New York (UTC-5).


How do I tell if a timestamp is in seconds or milliseconds?

Typically, a 10-digit number is a second-level timestamp, and a 13-digit number is a millisecond-level timestamp. The "Auto" mode in this tool detects the unit based on the number of digits and converts accordingly.

发现周边 发现周边
Comment area

Loading...