Unix Timestamp Converter

Instantly convert Unix timestamps to human-readable dates or convert dates to timestamp values. Professional-grade epoch converter with real-time timestamp conversion, UTC and local timezone support, millisecond precision, and code implementation examples in 8+ programming languages. Essential tool for developers, database administrators, system engineers, and DevOps professionals.

Current Unix Timestamp

Timestamp to Date

Supports seconds, milliseconds, microseconds and nanoseconds

UTC Time:

Local Time:

Date to Timestamp

Unix Timestamp:

Milliseconds:

What is Unix Timestamp?

A Unix timestamp (also called Epoch time or POSIX time) is the number of seconds that have elapsed since January 1, 1970, 00:00:00 UTC. It's a universal, timezone-independent format for representing time as a single integer—perfect for databases, APIs, and distributed systems. This converter supports seconds, milliseconds, microseconds, and nanoseconds.

Learn more about Unix timestamps, history, and technical details

Unix Timestamp Conversion & Time Unit Reference Table

Time PeriodSecondsMinutesHours
1 Minute6010.017
1 Hour3,600601
1 Day86,4001,44024
1 Week604,80010,080168
1 Month (30.44 days)2,629,74443,829.067730.484
1 Year (365.24 days)31,556,926525,948.7678,765.813

How to Convert Unix Timestamp to Human-Readable Date

Converting a Unix timestamp to a human-readable date is straightforward. Here are the basic steps:

  1. 1

    Enter the Unix timestamp

    Use the input field above labeled "Unix Timestamp" and enter your timestamp value. Supports seconds, milliseconds, microseconds, and nanoseconds.

  2. 2

    View the instant conversion

    The tool automatically displays the timestamp in both UTC and your local timezone with full date-time formatting below the input.

  3. 3

    Copy or use in code

    Copy the converted date to your clipboard using the copy button, or view code examples in your programming language below.

Pro tip: Unix timestamps are always in UTC. If your converted date looks different than expected, check if it needs to be converted to your local timezone.

Code Examples: Epoch Conversion in 8+ Languages

Convert Date to Unix Timestamp

PHP

// Convert human-readable date to Unix timestamp
strtotime("January 22, 2026");
// Result: 1737504000

// Alternative formats
strtotime("01/22/2026");
strtotime("+10 days"); // 10 days from now

// Object-oriented approach
$date = new DateTime('01/22/2026');
echo $date->format('U'); // Unix timestamp

// With timezone
$date = new DateTime('01/22/2026', new DateTimeZone('UTC'));
$timestamp = $date->getTimestamp();

JavaScript

// Convert date string to Unix timestamp
const myDate = new Date("January 22, 2026 00:00:00");
const myEpoch = Math.floor(myDate.getTime() / 1000);
console.log(myEpoch); // 1737504000

// Using Date.parse()
const timestamp = Math.floor(Date.parse("2026-01-22") / 1000);

// From individual components
const date = new Date(2026, 0, 22, 0, 0, 0);
const epoch = Math.floor(date.getTime() / 1000);

// Current timestamp
const now = Math.floor(Date.now() / 1000);

Python

import calendar
import time
from datetime import datetime

# Convert date string to Unix timestamp
date_string = '2026-01-22 00:00:00'
timestamp = calendar.timegm(time.strptime(date_string, '%Y-%m-%d %H:%M:%S'))
print(timestamp)  # 1737504000

# Using datetime module
dt = datetime(2026, 1, 22, 0, 0, 0)
timestamp = int(dt.timestamp())

# Current timestamp
import time
current_timestamp = int(time.time())

Java

import java.time.*;
import java.time.format.DateTimeFormatter;

// Convert date string to Unix timestamp
String dateString = "2026-01-22 00:00:00";
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime dateTime = LocalDateTime.parse(dateString, formatter);
long timestamp = dateTime.atZone(ZoneId.of("UTC")).toEpochSecond();
System.out.println(timestamp); // 1737504000

// From individual components
LocalDateTime dt = LocalDateTime.of(2026, 1, 22, 0, 0, 0);
long epochSecond = dt.toEpochSecond(ZoneOffset.UTC);

// Current timestamp
long currentTimestamp = Instant.now().getEpochSecond();

C#

using System;

// Convert DateTime to Unix timestamp
DateTime dateTime = new DateTime(2026, 1, 22, 0, 0, 0, DateTimeKind.Utc);
long timestamp = ((DateTimeOffset)dateTime).ToUnixTimeSeconds();
Console.WriteLine(timestamp); // 1737504000

// From string
DateTime parsedDate = DateTime.Parse("2026-01-22 00:00:00");
long unixTime = ((DateTimeOffset)parsedDate.ToUniversalTime()).ToUnixTimeSeconds();

// Current timestamp
long currentTimestamp = DateTimeOffset.Now.ToUnixTimeSeconds();

// Alternative using TimeSpan
DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
long timestamp2 = (long)(dateTime - epoch).TotalSeconds;

Go

package main

import (
    "fmt"
    "time"
)

func main() {
    // Convert date to Unix timestamp
    layout := "2006-01-02 15:04:05"
    dateString := "2026-01-22 00:00:00"
    t, _ := time.Parse(layout, dateString)
    timestamp := t.Unix()
    fmt.Println(timestamp) // 1737504000

    // From individual components
    date := time.Date(2026, time.Month(1), 22, 0, 0, 0, 0, time.UTC)
    unixTime := date.Unix()

    // Current timestamp
    currentTimestamp := time.Now().Unix()
    fmt.Println(currentTimestamp)
}

Swift

import Foundation

// Convert date string to Unix timestamp
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
dateFormatter.timeZone = TimeZone(abbreviation: "UTC")

if let date = dateFormatter.date(from: "2026-01-22 00:00:00") {
    let timestamp = Int(date.timeIntervalSince1970)
    print(timestamp) // 1737504000
}

// From Date components
let calendar = Calendar.current
let components = DateComponents(year: 2026, month: 1, day: 22,
                               hour: 0, minute: 0, second: 0)
if let date = calendar.date(from: components) {
    let unixTime = Int(date.timeIntervalSince1970)
}

// Current timestamp
let currentTimestamp = Int(Date().timeIntervalSince1970)

Rust

use chrono::{DateTime, Utc, NaiveDateTime, TimeZone};

// Convert date string to Unix timestamp
let date_str = "2026-01-22 00:00:00";
let naive_dt = NaiveDateTime::parse_from_str(date_str, "%Y-%m-%d %H:%M:%S").unwrap();
let dt: DateTime<Utc> = Utc.from_utc_datetime(&naive_dt);
let timestamp = dt.timestamp();
println!("{}", timestamp); // 1737504000

// From individual components
let dt = Utc.ymd(2026, 1, 22).and_hms(0, 0, 0);
let unix_time = dt.timestamp();

// Current timestamp
let now = Utc::now();
let current_timestamp = now.timestamp();

// Using std::time
use std::time::{SystemTime, UNIX_EPOCH};
let duration = SystemTime::now().duration_since(UNIX_EPOCH).unwrap();
let timestamp_std = duration.as_secs();

Convert Unix Timestamp to Date

PHP

// Convert Unix timestamp to human-readable date
$epoch = 1737504000;
$dt = new DateTime("@$epoch");
echo $dt->format('Y-m-d H:i:s'); // 2026-01-22 00:00:00

// With timezone
$dt->setTimezone(new DateTimeZone('America/New_York'));
echo $dt->format('Y-m-d H:i:s T');

// Using date() function
echo date('Y-m-d H:i:s', $epoch);
echo date('l, F j, Y g:i A', $epoch); // Full format

// Different formats
echo date('c', $epoch); // ISO 8601 format
echo date('r', $epoch); // RFC 2822 format

JavaScript

// Convert Unix timestamp to Date object
const timestamp = 1737504000;
const myDate = new Date(timestamp * 1000);
console.log(myDate.toString());
// Thu Jan 22 2026 00:00:00 GMT+0000 (UTC)

// Custom formatting
const year = myDate.getFullYear();
const month = String(myDate.getMonth() + 1).padStart(2, '0');
const day = String(myDate.getDate()).padStart(2, '0');
const formatted = `${year}-${month}-${day}`;

// Using toLocaleString for different formats
console.log(myDate.toLocaleString()); // Local format
console.log(myDate.toISOString()); // ISO format
console.log(myDate.toUTCString()); // UTC format

// Custom locale formatting
const options = { year: 'numeric', month: 'long', day: 'numeric', hour: '2-digit', minute: '2-digit' };
console.log(myDate.toLocaleDateString('en-US', options));

Python

import time
from datetime import datetime, timezone

# Convert Unix timestamp to human-readable date
timestamp = 1737504000
dt = datetime.fromtimestamp(timestamp, tz=timezone.utc)
print(dt.strftime('%Y-%m-%d %H:%M:%S'))  # 2026-01-22 00:00:00

# Using time module
formatted_time = time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime(timestamp))
print(formatted_time)

# Different formats
print(dt.strftime('%B %d, %Y at %I:%M %p'))  # Full format
print(dt.isoformat())  # ISO format
print(dt.strftime('%A, %B %d, %Y'))  # Day and date

# Local timezone
local_dt = datetime.fromtimestamp(timestamp)
print(f"Local time: {local_dt.strftime('%Y-%m-%d %H:%M:%S')}")

Java

import java.time.*;
import java.time.format.DateTimeFormatter;

// Convert Unix timestamp to LocalDateTime
long timestamp = 1737504000L;
Instant instant = Instant.ofEpochSecond(timestamp);
LocalDateTime dateTime = LocalDateTime.ofInstant(instant, ZoneOffset.UTC);
System.out.println(dateTime); // 2026-01-22T00:00:00

// Custom formatting
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String formatted = dateTime.format(formatter);
System.out.println(formatted);

// Different time zones
ZonedDateTime nyTime = instant.atZone(ZoneId.of("America/New_York"));
ZonedDateTime londonTime = instant.atZone(ZoneId.of("Europe/London"));

// Various formats
DateTimeFormatter fullFormatter = DateTimeFormatter.ofPattern("EEEE, MMMM d, yyyy 'at' h:mm a");
System.out.println(dateTime.format(fullFormatter));

C#

using System;

// Convert Unix timestamp to DateTime
long timestamp = 1737504000;
DateTime dateTime = DateTimeOffset.FromUnixTimeSeconds(timestamp).DateTime;
Console.WriteLine(dateTime.ToString("yyyy-MM-dd HH:mm:ss")); // 2026-01-22 00:00:00

// With timezone info
DateTimeOffset dto = DateTimeOffset.FromUnixTimeSeconds(timestamp);
Console.WriteLine(dto.ToString("yyyy-MM-dd HH:mm:ss zzz"));

// Different formats
Console.WriteLine(dateTime.ToString("F")); // Full date/time
Console.WriteLine(dateTime.ToString("D")); // Long date
Console.WriteLine(dateTime.ToString("T")); // Long time

// Custom format
string customFormat = dateTime.ToString("dddd, MMMM dd, yyyy 'at' h:mm tt");
Console.WriteLine(customFormat);

// UTC conversion
DateTime utcDateTime = dateTime.ToUniversalTime();

Ruby

# Convert Unix timestamp to Time object
timestamp = 1737504000
time = Time.at(timestamp).utc
puts time.strftime('%Y-%m-%d %H:%M:%S') # 2026-01-22 00:00:00

# Different formats
puts time.strftime('%A, %B %d, %Y at %I:%M %p') # Full format
puts time.strftime('%c') # Complete date and time
puts time.iso8601 # ISO 8601 format

# Local timezone
local_time = Time.at(timestamp)
puts "Local: #{local_time.strftime('%Y-%m-%d %H:%M:%S %Z')}"

# Using DateTime
require 'date'
dt = DateTime.strptime(timestamp.to_s, '%s')
puts dt.strftime('%Y-%m-%d %H:%M:%S')

Kotlin

import java.time.*
import java.time.format.DateTimeFormatter

// Convert Unix timestamp to LocalDateTime
val timestamp = 1737504000L
val instant = Instant.ofEpochSecond(timestamp)
val dateTime = LocalDateTime.ofInstant(instant, ZoneOffset.UTC)
println(dateTime) // 2026-01-22T00:00:00

// Custom formatting
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
val formatted = dateTime.format(formatter)
println(formatted)

// Different time zones
val nyTime = instant.atZone(ZoneId.of("America/New_York"))
val londonTime = instant.atZone(ZoneId.of("Europe/London"))

// Using extension functions
fun Long.toLocalDateTime(): LocalDateTime =
    LocalDateTime.ofInstant(Instant.ofEpochSecond(this), ZoneOffset.UTC)

val dt = timestamp.toLocalDateTime()
println("Formatted: ${dt.format(formatter)}")

Perl

#!/usr/bin/perl
use strict;
use warnings;
use POSIX qw(strftime);

# Convert Unix timestamp to human-readable date
my $timestamp = 1737504000;
my $formatted = strftime("%Y-%m-%d %H:%M:%S", gmtime($timestamp));
print "$formatted\n"; # 2026-01-22 00:00:00

# Different formats
print strftime("%A, %B %d, %Y at %I:%M %p", gmtime($timestamp)) . "\n";
print strftime("%c", gmtime($timestamp)) . "\n"; # Complete format

# Local time
my $local_formatted = strftime("%Y-%m-%d %H:%M:%S %Z", localtime($timestamp));
print "Local: $local_formatted\n";

# Using DateTime module (if available)
use DateTime;
my $dt = DateTime->from_epoch(epoch => $timestamp);
print $dt->strftime('%Y-%m-%d %H:%M:%S') . "\n";

Frequently Asked Questions

What is Unix timestamp vs ISO 8601 - what's the difference?

Unix timestamp is a single integer (e.g., 1704067200) representing seconds since 1970, always in UTC. ISO 8601 is a string format (e.g., 2026-01-01T00:00:00Z) that's human-readable with explicit timezone. Unix excels for calculations and storage efficiency, while ISO 8601 balances readability with machine parsing.

How do I convert milliseconds to Unix timestamp?

Divide milliseconds by 1000 to get Unix timestamp in seconds. Formula: Unix Timestamp = Milliseconds ÷ 1000. Example: 1609459200000 ms ÷ 1000 = 1609459200 seconds (January 1, 2021). Quick reference: 1 second = 1,000 ms, 1 minute = 60,000 ms, 1 hour = 3,600,000 ms, 1 day = 86,400,000 ms.

For comprehensive conversion tables, see the time units reference.

Why does my timestamp show a different time than expected?

Unix timestamps are always in UTC. If you see a different time, it's likely being displayed in your local timezone. Always consider timezone conversions when working with timestamps. The same Unix timestamp represents an identical moment globally—the display difference is purely local formatting.

Can Unix timestamps represent dates before 1970?

Yes, negative Unix timestamps represent dates before January 1, 1970. Negative values count backward from the epoch: -86400 represents December 31, 1969; -604800 represents December 25, 1969. Negative timestamps work in all programming languages supporting two's complement integers, making pre-1970 date handling seamless for legacy systems.

What programming languages support Unix timestamps?

All major programming languages provide native Unix timestamp support: JavaScript (Date.now()), Python (time.time()), PHP (time()), Java (Instant.now().getEpochSecond()), C# (DateTimeOffset.Now.ToUnixTimeSeconds()), Go (time.Now().Unix()), Ruby (Time.now.to_i), Swift (Int(Date().timeIntervalSince1970)), Rust (SystemTime::now()), and Kotlin (Instant.now().epochSecond).

See code examples for detailed implementation in each language.

Is Unix timestamp affected by timezone or daylight saving time?

No. Unix timestamps are always in UTC and represent an absolute point in time that remains constant regardless of timezone or daylight saving time changes. The same timestamp represents identical moments globally, making it reliable for distributed systems. The display in local time is separate from the timestamp value itself.

Key Benefits:

  • Consistent globally across all timezones
  • Unaffected by daylight saving time transitions
  • No ambiguity when comparing timestamps across regions
  • Perfect for distributed systems and global applications