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

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?

<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();
<span id="LastModified"></span>

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


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;


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

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