Last Modified Time Stamp

When was this file last modified? Assuming the name of this file is myPage.asp, this is how you would do it:
<%
 ' Set your objects here:
 Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
 Set objFile = objFSO.GetFile(Server.MapPath("myPage.asp"))
 dateModified = objFile.DateLastModified
 %>
 

 Then, show the stuff on your page:
 This file was modified on the date and time below:<br>
 You can write out the date as is:<br>
 <%=dateModified%><br>
 or special format it:<br>
 <%=FormatDateTime(dateModified,1)%> at <%=FormatDateTime(dateModified,3)%><br>
 <%
 ' don't forget to kill your objects!
 Set objFile = Nothing
 Set objFSO = Nothing
 %>

Example

This file was modified on the date and time below:
You can write out the date as is:
3/17/2014 2:26:12 PM
or special format it:
Monday, March 17, 2014 at 2:26:12 PM


fso last modified file system object


Back To Top
© 1998 - 2024 psacake.com
Version 7.21 | Advertise on this site