Timestamp Converter

时间戳转换

在线时间戳转换工具,Unix 时间戳与日期时间互转

当前时间戳:
北京时间:
时间戳 → 日期
时间戳:
转换结果:
日期 → 时间戳
日期时间:
转换结果:
秒 → 天时分秒
秒:
结果:

使用说明

时间戳是什么?

时间戳(Unix Timestamp)是指从1970年1月1日00:00:00 UTC到指定时间所经过的秒数或毫秒数。

时间戳类型:

  • 秒 (Unix Timestamp): 秒级时间戳:10位数字,如:1704067200
  • 毫秒 (JavaScript): 毫秒级时间戳:13位数字,如:1704067200000

时间单位换算

时间戳是指格林威治时间1970年01月01日00时00分00秒(北京时间1970年01月01日08时00分00秒)起至现在的总秒数。

时间单位秒数
1 hour3,600
1 day86,400
1 week604,800
1 month (30.44 days)2,629,743
1 year (365.24 days)31,556,926

各语言获取当前时间戳

PHPtime()
Pythontime.time()
RubyTime.now.to_i
Perltime
JavaSystem.currentTimeMillis()/1000
C#(DateTime.UtcNow - new DateTime(1970,1,1)).TotalSeconds
Gotime.Now().Unix()
JavaScriptMath.floor(Date.now()/1000)
Ras.numeric(Sys.time())
Shelldate +%s

时间戳转化成日期

PHPdate('Y-m-d H:i:s', $epoch)
Pythondatetime.utcfromtimestamp(epoch)
RubyTime.at(epoch)
Javanew Date(epoch*1000)
Gotime.Unix(epoch, 0)
JSnew Date(epoch*1000)
MySQLFROM_UNIXTIME(epoch)
PostgreSQLto_timestamp(epoch)
SQLitedatetime(epoch, 'unixepoch')
Shelldate -d @epoch

日期转化成时间戳

PHPstrtotime('2024-01-01')
Pythoncalendar.timegm(d.timetuple())
RubyTime.new(y,m,d).to_i
Javadate.getTime()/1000
Gotime.Date(...).Unix()
JSMath.floor(Date.parse(d)/1000)
MySQLUNIX_TIMESTAMP('2024-01-01')
PostgreSQLextract(epoch FROM d::timestamp)
SQLitestrftime('%s', d)
Shelldate -d "2024-01-01" +%s

Timestamp Converter

Online timestamp conversion tool

Runs locally · Nothing uploaded

Overview

A professional Unix timestamp converter that supports bidirectional conversion between timestamps and date/time values. It offers ISO 8601, RFC 2822, custom format outputs, and batch conversion capabilities to help developers quickly process time data.

Features

  • Unix timestamp conversion
  • Date/time bidirectional conversion
  • Multiple format support (ISO 8601, RFC 2822, etc.)
  • Automatic timezone detection
  • Batch conversion
  • Millisecond/second precision
  • Relative time calculation
  • Get current timestamp

How It Works

  1. 1 Enter a Unix timestamp (seconds or milliseconds) or date/time string in the input field
  2. 2 Select the desired output format such as ISO 8601, RFC 2822, or a custom format
  3. 3 Specify the timezone offset or enable automatic timezone detection
  4. 4 Review the converted result and click the copy button to export

Tips

  • When debugging API endpoints, quickly convert timestamps to readable dates to identify issues
  • Use batch conversion when processing database time fields to handle multiple records at once
  • When working across timezones, make sure to select the correct timezone offset to avoid time discrepancies

Related tools

Tags TimestampUnixDate

FAQ

Does it support both second and millisecond timestamps?

Yes. The tool automatically detects timestamp precision and correctly converts both 10-digit (seconds) and 13-digit (milliseconds) timestamps.

Can I convert multiple timestamps at once?

Absolutely. You can paste multiple timestamp entries (one per line) and the tool will convert them all in one batch, significantly improving efficiency.

How do I get the current Unix timestamp?

Click the "Get Current Timestamp" button to instantly retrieve both second-level and millisecond-level timestamps for the current time.