JSFiddle - React, Tailwind, and code Playground

by Victor Almeida

HTML

<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Mesure73L</title>
  <link href="index.css?v=1" rel="stylesheet" type="text/css" />
  <link rel="icon" type="image/x-icon" href="favicon.png">
</head>

<body>
  <div id="content">
    <p><span id="epoch">1700523189</span></p>
  </div>
</body>

</html>

JavaScript

window.onload = function() {
    // Get the current timestamp in seconds
    var milliseconds = new Date().getTime();

    // Create a Date object from the current timestamp
    let date = new Date(milliseconds * 1000);

    // Find the span element and set its content
    let epochSpan = document.querySelector('#epoch');
    if (epochSpan) {
        epochSpan.innerText = date;
    }
};