...

View Full Version : How to remove time from auto date & time showing script



tunayx
08-19-2008, 12:01 AM
This is auto date&time shower. I want to remove time from the script below, and also show date without day names, I want to show just 8-19-2008. What code should I remove or add?


<html>
<head>
<title>Last Modified</title>
<script type="text/javascript">
function getLastMod(){
var myFrm = document.getElementById('myIframe');
var lastModif = new Date(myFrm.contentWindow.document.lastModified);
document.getElementById('LastModified').innerHTML = "Prices correct as at: " + lastModif.toLocaleString();
}
</script>
</head>
<body>
<span id="LastModified"></span>

<iframe id="myIframe" onload="getLastMod()" src="prices.txt" style="display:none;">
</iframe>

</body>
</html>

Philip M
08-19-2008, 08:48 AM
<script type="text/javascript">

function getLastMod() {
var myFrm = document.getElementById('myIframe');
var lm = new Date(myFrm.contentWindow.document.lastModified);
var dt = lm.getDate();
var mm = lm.getMonth() + 1;
var yy = lm.getFullYear();
var lmDate = mm + "-" + dt + "-" + yy;
document.getElementById('LastModified').innerHTML = "Prices correct as at: " + lmDate;
}

</script>

"Money does not bring happiness, but it does enable you to be miserable in comfort". - Philip M's personal mantra

tunayx
08-19-2008, 12:55 PM
Worked fine, thanks lot Philip!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum