Welcome to WebmasterWorld Guest from 54.224.50.28

Forum Moderators: open

Message Too Old, No Replies

Automatic Revision Dates with JavaScript

How to change the 'Last Updated' automatically?

     

tommydc

11:11 am on Sep 27, 2001 (gmt 0)

Inactive Member
Account Expired

 
 


Hi,
I would like to change the date of 'Last Updated' on my web site automatically. With the JavaScript command "document.lastModified", I get something like
Last Updated: 09/27/2001 13:00:35
But I would only like to have the date, and not the hours:
Last Updated: 27/09/2001
or even better:
Last Updated: September 27, 2001
Which JavaScript command should I introduce?
Thank You
1:16 pm on Sept 27, 2001 (gmt 0)

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
posts:37301
votes: 0


Hi tommydc, and welcome to the forums at Webmaster World,

Here's a link to a page with one method: [chami.com...]

9:44 pm on Sept 27, 2001 (gmt 0)

Full Member

10+ Year Member

joined:Aug 16, 2001
posts:235
votes: 0


It would seem like the alternative would be to write something simple like this:

var sDate = document.lastModified();
document.write("Last updated on: " + sDate.substring(0,10));

2:38 pm on Sept 28, 2001 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 10, 2001
posts:793
votes: 0


<script>
var sSep = "/"
dModDate = new Date(document.lastModified);
dModDate = dModDate.getDate() + sSep + dModDate.getMonth() + sSep + dModDate.getYear()
document.write (dModDate);
</script>

You can change the separator by modifying the string sSep and swap the month and date to get US formatted dates.

5:03 pm on Sept 28, 2001 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 14, 2001
posts:129
votes: 0


I assume displaying the last modified date is for users only. Since most search engine spiders ignore JavaScript would they not miss this entirely?
10:32 pm on Sept 28, 2001 (gmt 0)

Full Member

10+ Year Member

joined:Aug 16, 2001
posts:235
votes: 0


JuniorHarris,
I believe you are correct, spiders will probably not pick up the JS code.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members