Home | Products | Consulting | Forums | Support | Order | 1-800-752-0455
  Main
Index
Search
Posts
Who's
Online
Log
In

Home: Older Forums & Discontinued Products: General Questions:
JS to show files last update date/time?

 

 


JamesKB
User

Aug 24, 2005, 7:59 PM

Post #1 of 5 (3587 views)
Shortcut
JS to show files last update date/time? Can't Post

HiYa....

I seem to remember there is some code that one can use to display the date/time info of an html document. Any one know what I'm talking about and what it is?

I do know it wont work on all servers but I think it will on mine.

Thanks for your time.Smile

Have a nice day....
--
James


ross
Staff / Moderator


Aug 25, 2005, 1:25 PM

Post #2 of 5 (3570 views)
Shortcut
Re: [JamesKB] JS to show files last update date/time? [In reply to] Can't Post

Hi James.

Thanks for posting and welcome to the board!

I recal the code that you are talking about. Cliff was working with it in Article Manager so that visitors could see when the article they are view was last updated.

The code looks like this:


Code
<script> 
document.write (document.lastModified);

</script>


The only problem is that it doesn’t actually seem like Article Manager sets the last up dated attribute of its files the way that JavaScript needs it to be. So you’ll find that the last updated time always gets set to the current time whenever you load an article. It works perfectly on Listings Manager though Smile.

If you don’t mind me asking, which program were you using?

Keep me up to date on how you are making out with the script Smile.
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Product Specialist
support@interactivetools.com


Hire me!
Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.




JamesKB
User

Aug 26, 2005, 4:20 PM

Post #3 of 5 (3547 views)
Shortcut
Re: [ross] JS to show files last update date/time? [In reply to] Can't Post

Thanks for the reply.

The code:

Code
<script>  
document.write (document.lastModified);
</script>


Does what I want. I want the guest to site to be able to see when the a given page was last updated.

The only problem with this code is that it renders differantlly in different browsers. For example:

IE6: This file modified on : 08/26/2005 17:21:12 Nashville, Tenn. USA -- This is acceptable to me.

FireFox 1.0.4: This file modified on : Fri, 26 Aug 2005 22:21:12 GMT Nashville, Tenn. USA -- This is not acceptable to me. Notice the time is in GMT. I want it to show the same time as it shows in IE6, i.e. USA Centeral Standard Time,

Opera 8.0.2: This file modified on : Fri, 26 Aug 2005 22:21:12 GMT Nashville, Tenn. USA -- This also is not acceptable to me because of the time shown as GMT.

Have a look at it at http://www.community-players.com/NoName.html

I've not tried it with any versions of Netscape or AOL, or on a Mac for that matter.

I guess I could test for which browser is being used and if it is FireFox or Opera then set a variable to -5 of what ever the GMT is.

Any other ideas of how to do this other than the above??

Thanks for your time.
--

Have a nice day....
--
James


Mike4172
User

Aug 26, 2005, 7:32 PM

Post #4 of 5 (3545 views)
Shortcut
Re: [JamesKB] JS to show files last update date/time? [In reply to] Can't Post

If your pages are .php there are a variety of php date features you can take advantage of that will all show up the same on all browsers. If your not using .php then you should start :)

Regards,
Michael
NEW!Logo and Website Design
Auto Post Date and Expiration
GoForum 2.02
http://www.amscripts.net
SKYPE - michael.amscripts


MikeB
Staff / Moderator


Aug 27, 2005, 2:35 PM

Post #5 of 5 (3517 views)
Shortcut
Re: [JamesKB] JS to show files last update date/time? [In reply to] Can't Post

Hi James,

Thanks for the post!

The document.lastModified statement is pretty raw and is designed to just give you straight output on when the page was last updated.

I did a quick Google search and I found several sites where people had taken the document.lastModified statement and used what it outputs to create a more attractive looking date format.

You can take a look at a couple of pages that have code you might be able to use here:

http://javascript.internet.com/page-details/last-modified.html
http://www.chipchapin.com/WebTools/JavaScript/example1-02.html

If you take a look at these or do a bit of searching you should be able to find some full JavaScript code that will give you the output you're looking for.

I hope this helps and if you have any other questions feel free to let me know! Smile

Cheers,
Mike Briggs - Product Specialist
support@interactivetools.com


Hire me!
Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.

 
 
 


Search for (options)
Products
CMS Builder
Article Manager
Realty Manager
Listings Manager
Order Now
Services
Priority Consulting
Support
Online Documentation
Support Forums
Support Homepage
Company Info
12 reasons to choose us!
Meet the team
Monthly newsletter
Contact Us
Toll Free: 1-800-752-0455
Phone: (604) 689-3347
Sales | Support
Conditions of Use | Privacy Policy | Copyright © interactivetools.com 2008
#201 - 2730 Commercial Drive, Vancouver BC Canada V5N 5P4