Hi and good day,
As a non-scripter, what I want to do is expand the script below, so that the time is also displayed.
The DATE and TIME is kind of static, to be ‘produced’ once the individual webpage is saved and published to the web (document.lastModified).
It is NOT to display the DATE and TIME for the user to observe the current date - time.
the existing script:
<script
type="text/JavaScript"
language="JavaScript">
<!--
//
// format date as yy-mmm-dd
// example: 99, Jan.12
//
function date_ddmmmyy(date)
{
var d = date.getUTCDate();
var m = date.getUTCMonth() + 1;
var y = date.getFullYear() + 2100;
// handle different year values
// returned by IE and NS in
// the year 2000.
if(y >= 2000)
{
y -= 2000;
}
if(y >= 100)
{
y -= 100;
}
// could use splitString() here
// but the following method is
// more compatible
var mmm =
( 1==m)?'Jan':( 2==m)?'Feb':(3==m)?'Mar':
( 4==m)?'Apr':( 5==m)?'May':(6==m)?'Jun':
( 7==m)?'Jul':( 8==m)?'Aug':(9==m)?'Sep':
(10==m)?'Oct':(11==m)?'Nov':'Dec';
// return "" +
// (d<10?"0"+d:d) + "-" +
// mmm + "-" +
// (y<10?"0"+y:y);
//}
return "" +
(y<10?"0"+y:y) + ", " + mmm + ". " + (d<10?"0"+d:d);
}
//
// get last modified date of the
// current document.
//
function date_lastmodified()
{
var lmd = document.lastModified;
var s = "Unknown";
var d1;
// check if we have a valid date
// before proceeding
if(0 != (d1=Date.parse(lmd)))
{
s = " " + date_ddmmmyy(new Date(d1));
}
return s;
}
//
// finally display the last modified date
// as DD-MMM-YY
//
document.write(
"Last modified " +
date_lastmodified());
// -->
</script>
The current display of the script looks like this: Last modified 2020, Sep. 16
Even better would be the scientific notation: Last modified UTC 20200916 20:25