Skip to content
🛠️ToolsShed

Epoch Batch Converter

Convert multiple Unix timestamps at once — auto-detects seconds vs milliseconds.

Enter timestamps above and click Convert.

About this tool

Unix timestamps are the standard way computers represent points in time, counting seconds (or milliseconds) since January 1, 1970. However, converting a single timestamp manually is tedious, and when you have dozens or hundreds of timestamps to convert, doing it one by one becomes impractical. The Epoch Batch Converter solves this by letting you paste multiple timestamps at once and automatically detecting whether they are in seconds or milliseconds, then converting them all to human-readable dates.

To use the tool, simply paste your timestamps into the input field—one per line or separated by any common delimiter like commas or spaces. The converter will instantly process all of them, display the results with full date and time information, and let you copy the entire output at once. This is particularly useful for developers working with server logs, databases, or API responses where timestamps are abundant, and for analysts who need to understand when events occurred across large datasets.

Frequently Asked Questions

Code Implementation

from datetime import datetime, timezone

def timestamps_to_iso(timestamps: list[int | float], unit: str = "s") -> list[str]:
    """Convert a list of Unix timestamps to ISO 8601 strings.
    unit: 's' for seconds, 'ms' for milliseconds
    """
    results = []
    for ts in timestamps:
        if unit == "ms":
            ts = ts / 1000
        dt = datetime.fromtimestamp(ts, tz=timezone.utc)
        results.append(dt.isoformat())
    return results

def iso_to_timestamps(iso_strings: list[str], unit: str = "s") -> list[int]:
    """Convert a list of ISO 8601 strings to Unix timestamps."""
    results = []
    for s in iso_strings:
        dt = datetime.fromisoformat(s.replace("Z", "+00:00"))
        ts = dt.timestamp()
        if unit == "ms":
            ts = int(ts * 1000)
        else:
            ts = int(ts)
        results.append(ts)
    return results

# Example
timestamps = [0, 1000000000, 1700000000, 2000000000]
print("Timestamps to ISO:")
for ts, iso in zip(timestamps, timestamps_to_iso(timestamps)):
    print(f"  {ts} -> {iso}")

print("ISO to timestamps:")
isos = ["1970-01-01T00:00:00+00:00", "2023-11-14T22:13:20+00:00"]
for iso, ts in zip(isos, iso_to_timestamps(isos)):
    print(f"  {iso} -> {ts}")

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.