Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Automatic Revision Dates with JavaScript

How to change the 'Last Updated' automatically?



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

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 Sep 27, 2001 (gmt 0)

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

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 Sep 27, 2001 (gmt 0)

10+ Year Member

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 Sep 28, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

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

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 Sep 28, 2001 (gmt 0)

10+ Year Member

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 Sep 28, 2001 (gmt 0)

10+ Year Member

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

Featured Threads

Hot Threads This Week

Hot Threads This Month