Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date format

Status
Not open for further replies.

nabbs

Programmer
Feb 21, 2001
18
GB
Hi there,

I've got a script for "page last updated".. but I need to change the date format to British format.. can anyone help??

thanx


<SCRIPT LANGUAGE=&quot;JavaScript&quot;>

var m = &quot;Page last updated &quot; + document.lastModified;
var p = m.length-8;
document.writeln(&quot;<left>&quot;);
document.write(m.substring(p, 0));
document.writeln(&quot;</left>&quot;);
</SCRIPT>
 
setLocale
or play with the substrings of the date (instead of displaying 01 23 4567 you'll want to display 23 01 4567 - easy)
 
i have tried it but it still does not work... what do i do?...

 
Hi,

How about:
Code:
lastmod = new Date(m.substring(p, 0));
if ((lastmod.getMonth()+1) < 10) month = &quot;0&quot; + String(lastmod.getMonth()+1)
else month = String(lastmod.getMonth()+1);
if ((lastmod.getDate()+1) < 10) day = &quot;0&quot; + String(lastmod.getDate())
else day = String(lastmod.getDate());
document.write(day+&quot; &quot;+month+&quot; &quot;+lastmod.getFullYear());

Regards,
Luís Silva
 
Thanx for your script Luis, I found another script which was similar to yours and I modified it to look like the above...so thanx very much!

regards,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top