<?php
echo "Actualizado: ".date("F d Y.", getlastmod());
?>
Como resultado se obtiene el día, el mes y el año, pero con el inconveniente de que el mes se muestra en idioma inglés.<?php
setlocale(LC_TIME, 'es_ES'); $date = date ("F d Y", getlastmod());
echo "Actualizado: " .strftime('%d de %B del %Y',strtotime($date));
?>
strftime es una función de PHP para dar formato a una marca de tiempo de Unix en función de la configuración regional actual, mediante la setlocale.<script>
function makeArray() {
for (i = 0; i<makeArray.arguments.length; i++)
this[i + 1] = makeArray.arguments[i];}
var months = new makeArray('Enero','Febrero','Marzo','Abril','Mayo',
'Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre');
var date = new Date(document.lastModified);
var day = date.getDate();
var day2 = (day < 10) ? '0' + day : day;
var month = date.getMonth() + 1;
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;
var fecha = day+" de "+months[month]+" del "+year;
document.write("Actualizado: "+fecha);
</script>
Es solo un ejemplo, document.write no está recomendado.<div id="lastmod"></div>
<script>
function makeArray() {
for (i = 0; i<makeArray.arguments.length; i++)
this[i + 1] = makeArray.arguments[i];}
var months = new makeArray('Enero','Febrero','Marzo','Abril','Mayo',
'Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre');
var date = new Date(document.lastModified);
var day = date.getDate();
var day2 = (day < 10) ? '0' + day : day;
var month = date.getMonth() + 1;
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;
var fecha = day+" de "+months[month]+" del "+year;
document.getElementById('lastmod').innerHTML= "Actualizado: "+fecha;
</script>
Mas informacion sobre
Como mostrar la fecha y hora en las páginas web usando Javascript<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Article",
"datePublished":"2023-01-12T01:25:47+01:00",
<?php
echo '"dateModified": "'. date ("c", getlastmod()).'",';
?>
}
</script>