Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-18-2008, 11:01 PM   PM User | #1
tunayx
New Coder

 
Join Date: Apr 2007
Posts: 58
Thanks: 3
Thanked 0 Times in 0 Posts
tunayx is an unknown quantity at this point
How to remove time from auto date & time showing script

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>

Last edited by tunayx; 08-18-2008 at 11:05 PM..
tunayx is offline   Reply With Quote
Old 08-19-2008, 07:48 AM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,043
Thanks: 197
Thanked 2,412 Times in 2,390 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Code:
<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
Philip M is offline   Reply With Quote
Users who have thanked Philip M for this post:
tunayx (08-19-2008)
Old 08-19-2008, 11:55 AM   PM User | #3
tunayx
New Coder

 
Join Date: Apr 2007
Posts: 58
Thanks: 3
Thanked 0 Times in 0 Posts
tunayx is an unknown quantity at this point
Worked fine, thanks lot Philip!
tunayx is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:15 AM.


Advertisement
Log in to turn off these ads.