Back to Blog
Guide8 min read

How to Convert Epoch Time in Popular Languages

Published on August 21, 2026

Converting between Unix timestamps and human-readable dates is a daily task for software developers. Here is a complete guide to timestamp conversions in JavaScript, Python, Go, Java, C#, and SQL.

JavaScript & TypeScript

// Get current timestamp in milliseconds
const nowMs = Date.now();

// Convert Date to Seconds
const nowSec = Math.floor(nowMs / 1000);

// Convert Seconds Timestamp to Date
const date = new Date(nowSec * 1000);
console.log(date.toUTCString());

Python

import time
from datetime import datetime, timezone

# Get current timestamp in seconds
ts = int(time.time())

# Convert timestamp to UTC datetime
dt = datetime.fromtimestamp(ts, tz=timezone.utc)
print(dt.isoformat())

Go

package main

import (
    "fmt"
    "time"
)

func main() {
    // Current Unix timestamp
    now := time.Now().Unix()
    fmt.Println(now)

    // Unix to time.Time
    tm := time.Unix(now, 0).UTC()
    fmt.Println(tm.Format(time.RFC3339))
}

Try Our Interactive Converters