Site icon A Free Tools

Timestamp Converter

Timestamp Converter- Convert Unix timestamps to readable dates, calculate relative time, and generate JavaScript code instantly

Current Unix Timestamp
Loading…
Local Time:
UTC:
ISO 8601:
Milliseconds:
Relative:
Quick Presets
-1h
1 Hour Ago
-1d
1 Day Ago
-1w
1 Week Ago
-1m
1 Month Ago
+1h
1 Hour Ahead
+1d
1 Day Ahead
Supports: Unix timestamp (seconds/milliseconds), ISO 8601, RFC 2822, or natural language
Unix Timestamp (Seconds):
Unix Timestamp (Milliseconds):
Date (Local):
Date (UTC):
ISO 8601:
RFC 2822:
Relative Time:
Enter one timestamp or date per line. Supports Unix timestamps, ISO dates, and natural language.
Results:
00
Days
00
Hours
00
Minutes
00
Seconds
JavaScript Code Examples
// Get current Unix timestamp (seconds)
const timestamp = Math.floor(Date.now() / 1000);
console.log(timestamp); // Output: 1785579804

// Get current Unix timestamp (milliseconds)
const msTimestamp = Date.now();
console.log(msTimestamp); // Output: 1785579804000
// Convert Unix timestamp to Date object
const timestamp = 1785579804;
const date = new Date(timestamp * 1000);

console.log(date.toISOString()); // "2026-07-30T17:56:44.000Z"
console.log(date.toLocaleString()); // "7/30/2026, 5:56:44 PM"
// Convert Date to Unix timestamp
const date = new Date('2024-01-15T10:30:00Z');
const timestamp = Math.floor(date.getTime() / 1000);

console.log(timestamp); // 1705315800
// Convert Unix timestamp to different formats
const ts = 1785579804;
const date = new Date(ts * 1000);

// ISO 8601
date.toISOString();         // "2026-07-30T17:56:44.000Z"

// RFC 2822
date.toUTCString();         // "Thu, 30 Jul 2026 17:56:44 GMT"

// Local string
date.toLocaleDateString();  // "7/30/2026"
date.toLocaleTimeString();  // "5:56:44 PM"
// Calculate relative time (time ago)
function timeAgo(timestamp) {
    const seconds = Math.floor((Date.now() / 1000) - timestamp);
    const intervals = {
        year: 31536000, month: 2592000, week: 604800,
        day: 86400, hour: 3600, minute: 60
    };
    for (const [unit, secondsInUnit] of Object.entries(intervals)) {
        const interval = Math.floor(seconds / secondsInUnit);
        if (interval >= 1) return `${interval} ${unit}${interval > 1 ? 's' : ''} ago`;
    }
    return 'just now';
}

console.log(timeAgo(1785579804)); // "2 minutes ago"

What can our Timestamp Converter do?

The free online timestamp converter is a powerful tool for developers, sysadmins and anyone who works with time-based data to instantly convert Unix timestamp to human-readable dates and vice versa. We make time conversion so simple whenever you’re debugging APIs, analyzing log files or scheduling events.

How to Use Our Timestamp Converter

Our timestamp converter is easy to use and simple to get started with. Here are some basic steps to follow:

Understanding Unix Timestamps

A Unix timestamp (also Unix time, POSIX time or epoch time) is a representation of a moment in time as the number of seconds that have passed since 00:00:00 UTC on January 1, 1970 (also known as the Unix epoch). Unix timestamps are also integers, which computers can easily compare, sort and perform calculations on, unlike human readable dates.

Wikipedia states that the Unix timestamp ignores leap seconds and is commonly used in operating systems and file formats. How you usually store time in programming languages, databases and APIs.

Time UnitSecondsUnix Timestamp Example
1 Minute60 seconds60
1 Hour3,600 seconds3600
1 Day86,400 seconds86400
1 Week604,800 seconds604800
1 Month (30 days)2,592,000 seconds2592000
1 Year (365 days)31,536,000 seconds31536000

To learn more about date handling in JavaScript, look at the MDN Web Docs: Date objects in JavaScript.

Calculators | Converters | Games | Generators | Random | Web Tools | Developer Tools

Exit mobile version