?
Solved

Dispalay Date Last Saved on Page

Posted on 2005-04-15
9
Medium Priority
?
358 Views
Last Modified: 2010-05-18
I'd like to display the date & time my ASP file was last saved on the page when it's browsed. The javaScript I've tried always shows the current date/time since, of course, these are dynamically generaged pages.  

Is there a way to display in the actual file save date of an ASP file instead of the date the page was browsed?
0
Comment
Question by:leslieinva
  • 3
  • 2
  • 2
  • +1
9 Comments
 
LVL 23

Assisted Solution

by:Saqib Khan
Saqib Khan earned 200 total points
ID: 13791026
<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("c:\test.txt")
Response.Write("File last modified on: ")
Response.Write(f.DateLastModified)
set f=nothing
set fs=nothing
%>Output:

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

Accepted Solution

by:
thefritterfatboy earned 200 total points
ID: 13791289
The problem is - can you open the ASP script file while the ASP script is running? (I'm assuming you can)

Using adilkahn's method you could use:

<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile(server.mappath(Request.ServerVariables("SCRIPT_NAME")))
Response.Write("File last modified on: ")
Response.Write(f.DateLastModified)
set f=nothing
set fs=nothing
%>
0
 
LVL 33

Expert Comment

by:hongjun
ID: 13800305
But make sure your NAV (if you have) allows scripting.

hongjun
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 23

Expert Comment

by:Saqib Khan
ID: 13802084
not just NAV it could be any AntiVirus Software.
0
 

Author Comment

by:leslieinva
ID: 13841720
Thank you guys for you help, but I can't get either of these ideas to work, so I must have misinterpreted something here.

In adilkhan's script, is c:\test.txt supposed to be the name of my asp file whoes last update I'm trying to display?

In thefritterfatboy's script, what exactly is SCRIPT_NAME?  Is it the asp file?

0
 
LVL 10

Expert Comment

by:thefritterfatboy
ID: 13842457
Request.servervariables("SCRIPT_NAME") will return the name of the script running. Let's say your script is called mypage.asp- "mypage.asp" is the string returned. This server variable will ignore the querystring and full URL and only return the name of the file.

I did test my script and it worked for me. As mentioned above - please ensure your ati-virus does not have any form of script blocking that prohibits access to the filesystem object.
0
 

Author Comment

by:leslieinva
ID: 13844427
It worked great this time!

One last related question, how would you format the DateLastModified so that instead of:
 4/22/2005 12:25:22 PM

it would show the time without the seconds, like:
 4/22/2005 12:25 PM
0
 
LVL 33

Expert Comment

by:hongjun
ID: 13844533
Try this

Response.Write DateValue(yourdate) & " " & Split(TimeValue(Now), ":")(0) & ":" & Split(TimeValue(Now), ":")(1) & " " & Right(Now, 2)



hongjun
0
 
LVL 33

Assisted Solution

by:hongjun
hongjun earned 100 total points
ID: 13844536
Try this

Response.Write DateValue(yourdate) & " " & Split(TimeValue(yourdate), ":")(0) & ":" & Split(TimeValue(yourdate), ":")(1) & " " & Right(yourdate, 2)



hongjun
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question