devxlogo

Dynamically Display the Last Modified Date

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.

 <%Dim szPathDim fsoSzPath = Request.ServerVariables("PATH_TRANSLATED")Set fso = Server.CreateObject("Scripting.FileSystemObject")Response.Write "Last Modified Date: " _& FormatDateTime(fso.GetFile(szPath).DateLastModified,1)%>
See also  How College Students Can Shape the Future of Tech Responsibility
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist