by David Koopman (11 Submissions)
Category: Internet/HTML
Compatability: VB Script
Difficulty: Unknown Difficulty
Originally Published: Thu 6th March 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Display Date Last Updated on any web page.
<%
strPath = Request.ServerVariables("APPL_PHYSICAL_PATH")
'Retrieves the physical path corresponding to the metabase path. IIS converts the
'APPL_MD_PATH to the physical (directory) path to return this value.
Set objFSO = CreateObject("Scripting.FileSystemObject") 'Create instance of FileSystemObject
Set objFolder = objFSO.GetFolder(strPath) 'Retrieve folder of current page
Set rstFolders = server.CreateObject("ADODB.Recordset") 'Open a client side recordset
rstFolders.fields.append "fname", 200, 50
rstFolders.fields.append "fdate", 7
rstFolders.open
strFilePath = Request.ServerVariables("SCRIPT_NAME")
vFile = Split(strFilePath, "/") 'Exact filename i.e timestamp.asp
For Each objItem In objFolder.Files
' Deal with the VTI's that give 404's
If InStr(1, objItem, "_vti", 1) = 0 Then
If objItem.Name = vFile(UBound(vFile)) Then 'Add file to recordset
rstFolders.addnew
rstFolders.fields("fname").Value = objItem.Name
rstFolders.fields("fdate").Value = objItem.DateLastModified
End If
End If
Next
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<FORM name="frmLastUpdate">
<%If not rstFolders.BOF and not rstFolders.EOF then 'Should never be BOF and EOF but just in case.%>
<% '------------ FORMAT LAST MODIFIED DATE FOR DISPLAY -----------------------
strUDate = Split(rstFolders.Fields("fdate").Value, " ")
strDate = strUDate(0)
strTime = strUDate(1)
'strAP = strUDate(2) 'AM PM not used here but easily added.
strVT = Split(strTime, ":")
strH= strVT(0) & ":" & strVT(1) & " ET" 'TIME FORMATTED
strVD = Split(strDate, "/")
strM = MonthName(strVD(0), True) 'Month name abbreviated = True
strND = strM & " " & strVD(1) & ", " & strVD(2) 'DATE FORMATTED
%>
<% ' ------------ DISPLAY DATE LAST MODIFIED --------------------- %>
<%="<DIV align=right><FONT color=navy size=1 face=arial>Updated: " & strH & " " & strND & "</FONT></DIV>"%>
<%End If%>
<BR>
<CENTER>
Begin your content here
<BR>
</FORM>
</BODY>
</HTML>