By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,115 Members | 894 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,115 IT Pros & Developers. It's quick & easy.

Last Modified problems

P: n/a
Hi, hope you can help me with this one.

If I want to get the date a page has been last modified, I can do something
like ..

document.write("<b>Last updated: "+document.lastModified+"</b>");

Can I use this to display the date that other pages were last modified - eg
other pages on my website?
I want my index.htm to display the last modified date of other pages on the
website without me manually updating.

Thanks!

Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
JRS: In article <bd**********@hercules.btinternet.com>, seen in
news:comp.lang.javascript, Amanda <ad*****@hotmail.com> posted at Sun,
29 Jun 2003 17:22:05 :-
If I want to get the date a page has been last modified, I can do something
like ..

document.write("<b>Last updated: "+document.lastModified+"</b>");
If you use that form on the Web, some browsers will display the American
date format, even to users in Europe. So only modify when, in the date,
D=M or D>12. Moreover, the year may be two-digit, and Easterners read
dates with year first.

Can I use this to display the date that other pages were last modified - eg
other pages on my website?
I want my index.htm to display the last modified date of other pages on the
website without me manually updating.


It is in fact not the date that the file was last "really" modified, but
the date of the last upload or change that lastModified contains. It is
IMHO better to use a more subtle scheme, such as editing manually or by
running a local program [+], to record when the last change that the
reader needs to know about was made, and to do so unambiguously - e.g.
2003-06-30 or 2003 Jun 30.

See <URL:http://www.merlyn.demon.co.uk/js-date3.htm#lM> about
lastModified.

I don't know a way to get the lastModified of another page[*], which
suggests that there may not be a reasonable one.

[+] DOS Batch program up-dates.bat, to be uploaded into directory
<URL:http://www.merlyn.demon.co.uk/programs/>, uses other programs HUNT,
COLS, EKKO, NOWMINUS in that directory to generate an HTML page
alphabetically listing *.htm files and dates for the current directory.
Possibly to be developed. Currently gives (format adaptable) lines like
<li> 2003/06/19-18:55:50   <a href="batfiles.htm">BATFILES.HTM</a>
Note : 8.3 filenames ONLY (for LFN, modify to use DOS dir command).
[*] One might be able to load that other page into a frame, and access
its lastModified, but that would require loading the other page in full,
probably largely defeating the object of the exercise.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk DOS 3.3, 6.20; Win98.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
PAS EXE TXT ZIP via <URL:http://www.merlyn.demon.co.uk/programs/00index.htm>
My DOS <URL:http://www.merlyn.demon.co.uk/batfiles.htm> - also batprogs.htm.
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.