MidImageAI

Timestamp Converter

Convert between Unix Timestamp and Date/Time

Timestamp → Date/Time

Supports seconds (10 digits) and milliseconds (13 digits), auto-detected

Date/Time → Timestamp

--::

What is a Unix Timestamp?

A Unix timestamp (also known as Epoch time) is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds. It is widely used in computer systems because it is a simple integer that is easy to store and compute.

However, timestamps are not human-friendly, so they need to be converted into readable date and time formats. This tool quickly converts timestamps to human-readable date/time formats and also supports the reverse conversion.

Common Timestamp Ranges

  • Seconds-based (10 digits): e.g. 1713340800, represents 2024-04-17 12:00:00
  • Milliseconds-based (13 digits): e.g. 1713340800000, commonly used in JavaScript, Java, etc.

Local Time & UTC

This tool converts timestamps using your browser's local timezone by default. UTC (Coordinated Universal Time) is the primary time standard by which the world regulates clocks.

Advertisement

Get Current Timestamp in Various Languages

LanguageCode
JavaScript
Math.round(new Date() / 1000)
Python
import time
time.time()
Java
System.currentTimeMillis() / 1000

// Java >= 8
Instant.now().getEpochSecond()
Go
import "time"
time.Now().Unix()
PHP
<?php
time();
Ruby
Time.now.to_i
C#
DateTimeOffset.UtcNow.ToUnixTimeSeconds();
Shell
date +%s
Swift
NSDate().timeIntervalSince1970
Objective-C
[[NSDate date] timeIntervalSince1970]
MySQL
SELECT unix_timestamp(now())
SQLite
SELECT strftime('%s', 'now')
Dart
(DateTime.now().millisecondsSinceEpoch / 1000).truncate()
Lua
os.time()
Erlang
calendar:datetime_to_gregorian_seconds(
  calendar:universal_time())-719528*24*3600.
Groovy
(new Date().time / 1000).longValue()
Rust
use std::time::SystemTime;
SystemTime::now()
  .duration_since(SystemTime::UNIX_EPOCH)
  .unwrap()
  .as_secs()