Script Output:
This file was modified on the date and time below:
You can write out the date as is...
3/23/2000 10:30:24 PM;
or format it as you like!
Thursday, March 23, 2000; at 10:30:24 PM
This one here is a little tricky! This sample will only work if you are
running IIS4 or a newer version of the VBscript library than the one that
ships with IIS3. It requires the built in FileSystemObject's
DateLastModified property which isn't available in IIS3!
If you aren't running IIS4, you need to call a component in order to get the
information about the file. Unfortunately, IIS3 doesn't include a component
to do this, so being the nice people we are....we wrote one! Where
else do you get service like that? Our component works in both IIS3 and IIS4,
and is quite simple to use.
For those of you still using IIS3, here's the sample code to use our component:
<%
Dim objCMFU
Dim strModified
' Creates the object and assigns it to our variable.
' The 'GetProperty' class is the only one currently available.
Set objCMFU = Server.CreateObject("CM_FileUtils.GetProperty")
' Retrieves the return value of the LastModified function.
' Again the only one currently available. The function returns
' a string containing the Date and Time last modified or the string
' "Error!" if something goes wrong.
strModified = objCMFU.LastModified
' Kills our object.
Set objCMFU = Nothing
%>
<% If strModified = "Error!" Then %>
Oops! We can't be getting errors on the sample page!
<% Else %>
This file was modified on the date and time below:
You can write out the string as is...
<%= strModified %>
or format it as you like!
<%= FormatDateTime(CDate(strModified),1) %> at <%= FormatDateTime(CDate(strModified),3) %>
<% End If %>
You can download the latest version of the CM_FileUtils component used in this
example here!
For those of you lucky enough to have IIS4, you can view the asp or html
source code as usual by clicking on the view code buttons.