Gallery

miércoles, 21 de octubre de 2026

JS - Fecha en tu sitio web

 Agrega la fecha en tu página web con Javascript


Solo para copiar y pegar.. Puede ser en el mismo html o en archivos separados.


   <span id="fecha-actual"></span>


#fecha-actual{
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
    font-size: 1.2rem;
    background: rgb(39, 38, 38);
    color: whitesmoke;
    padding: 10px;
}


    <script>
          const hoy = new Date();
          const opciones = { year: 'numeric', month: 'long', day: 'numeric',
            weekday: 'long' };
          const fechaFormateada = hoy.toLocaleDateString('es-ES', opciones);
          document.getElementById('fecha-actual').textContent = fechaFormateada;
    </script>

No hay comentarios:

Publicar un comentario

Documental de Hackers