JSFiddle - React, Tailwind, and code Playground
by Rufuus06
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Get()</title>
</head>
<body>
<h2>Get():</h2>
<p>Devuelve la fecha y hora actuales.</p>
<p>GetHours(): </p>
<p id="exp"></p>
</body>
</html>
JavaScript
var time = new Date();
var hora = time.getHours(time);
document.getElementById("exp").innerHTML = hora + "h";