homepage Welcome to WebmasterWorld Guest from 54.82.1.136
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Automatic Revision Dates with JavaScript
How to change the 'Last Updated' automatically?
tommydc




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

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

 

tedster




msg:1481683
 1:16 pm on Sep 27, 2001 (gmt 0)

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

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

andrey_sea




msg:1481684
 9:44 pm on Sep 27, 2001 (gmt 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));

joshie76




msg:1481685
 2:38 pm on Sep 28, 2001 (gmt 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.

JuniorHarris




msg:1481686
 5:03 pm on Sep 28, 2001 (gmt 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?

andrey_sea




msg:1481687
 10:32 pm on Sep 28, 2001 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved