Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Web
Expertise: All
Aug 13, 1999

Dynamically Display the Last Modified Date

A lot of Web pages have a last modified date at the bottom of the page. Although this is a feature easily managed by changing the HTML, a better approach would to generate the last modified date dynamically through ASP.

The key is to extract this information from your file system. First, use the "PATH_TRANSLATED" Request variable to retrieve the physical path of the file on your server. Then, using the FileSystemObject, you can get the last modified date from the file system. Finally, convert the general date time format to the format of your choice.

 
<html>
<body>
<%
Dim szPath
Dim fso
SzPath = Request.ServerVariables("PATH_TRANSLATED")
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Response.Write "Last Modified Date: " _
& FormatDateTime(fso.GetFile(szPath).DateLastModified,1)
%>
</body>
</html>
William Wen
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date