JSFiddle - React, Tailwind, and code Playground

HTML

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Unix-Zeitstempel Konvertierung</title>
</head>
<body>
    <h1>Unix-Zeitstempel Konvertierung</h1>
    <p><strong>Aktueller Unix-Zeitstempel:</strong> <span id="unix-timestamp">...</span></p>
    <p><strong>Umgewandelte Zeit:</strong> <span id="converted-time">...</span></p>
</body>
</html>

JavaScript

document.addEventListener("DOMContentLoaded", function () {
    function updateTime() {
        const now = Math.floor(Date.now() / 1000); // Aktueller Unix-Timestamp
        document.getElementById("unix-timestamp").textContent = now;

        // Umwandlung in lesbare Zeit
        const date = new Date(now * 1000);
        const formattedTime = date.toLocaleString("de-DE", { timeZone: "Europe/Berlin" });
        document.getElementById("converted-time").textContent = formattedTime;
    }

    updateTime(); // Initiale Anzeige
    setInterval(updateTime, 1000); // Aktualisierung jede Sekunde
});