Retrieve filedate / Time

I want to show this file:

But I also want to show the date and  time (LastmodifiedTime)

Is this possible i ASP.

Thanks in advance
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Something like this should work:

System.IO.File.GetLastWriteTime(Server.MapPath("web2.jpg")).ToString("HH:mm:ss dd/MM/yyyy")

Open in new window

Please note, if that picture is NOT on your own server, it's of no use.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
Yes, you can use fso (File Scripting Object)

dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("c:\path_to\maps\MSCDIVINAweb2.jpg")
Response.Write("File last modified on: ")
set f=nothing
set fs=nothing


File last modified on: 1/10/2001 10:01:19 AM

Open in new window

steltonAuthor Commented:
The file is on an external URL, will your solutions Works with that?
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

As I clearly said, it WILL NOT WORK. A remote server doesn't give you this information.
steltonAuthor Commented:
Sorry has not seen your note.... I understand....
Actually, I wasn't 100% accurate. A web server _CAN_ send you the last modified date (can also be removed though), and it's a matter if you trust this info or not.
For use the HttpRequest and then read the headers.
Classic ASP should use MSXML2.ServerXMLHTTP (again, read headers)
steltonAuthor Commented:
Okay... if I trust the info, how do I then retrieve the date / time of the file with asp code
what ASP version are you running?
steltonAuthor Commented:
V4.0 found on the IIS server does that make sence? Else how to found out?
This is working code:

<%@ Page Language="VB" %>
<%@ Import Namespace="System.Net" %>


<title>Get last-modified</title>
<body bgcolor="#FFFFFF">

<script language="vbscript" type="text/vbsscript" runat="server">

function getURLHeader(url)

Dim strings as WebHeaderCollection
Dim output as String
 Dim myHttpWebRequest As HttpWebRequest = CType(WebRequest.Create(url), HttpWebRequest)
            ' Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable. 
            Dim myHttpWebResponse As HttpWebResponse = CType(myHttpWebRequest.GetResponse(), HttpWebResponse)
            strings = myHttpWebResponse.Headers
			output = strings.Get("Last-Modified")

		return output
end function


<% response.Write(getURLHeader(""))


Open in new window

steltonAuthor Commented:
Thank you. I have tried to save the code to an asp fil, but I get a "500 - Internal server error."

The server I use is my own. Could it have something to do with the rights you are talking about. If yes could you give me a hint where to change them.. if it is this issue which are the problem.
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
Using Kimputer's code, you should be saving your file as .aspx and not .asp.
steltonAuthor Commented:
Thank you that Works :-)

Now I only want to understand the time it shows:

Wed, 08 Apr 2015 06:10:02 GMT

The time at me is 08.33 (Morning) and at the ship it schould be 02.33 (Night)

I know that there will be a difference becauase of the refreshing of the webcam Picture, but how to explain the time of the Picture to 06:10:02 GMT
GMT is greenwich mean time. Just get your time zone offset and always add or substract that offset (hopefully daylight saving won't be an issue, but otherwise, one or two months per year it will be one hour off, unless you use some more code to fix it, or have a smart time converter.
From your info, you're probably in the CEST time zone with a GMT 2+ hour difference (the returned time is in 24hr format), while the ship is in EST time (GMT -4 hour)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.