Automated Date Update in ASP pages

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

stephanlh

Thread Starter
Joined
Jul 6, 2005
Messages
5
I am trying to find some code that I could use to make an asp page update automatically everytime it is changed. I have done this with the html pages using the code before the place for the date (in our case at the bottom of the page in the footer) <!-- #echo var="Last Modified"--> and because I live in Canada and we do not use the same date form as Americans, I also placed before the date (actually just after the header) the code <!--#config timefmt="%Y-%m-%d"--> so that the date will appear as year, month and day as it is suppose to be in all official documents in Canada. The only problem is this code only works in html and not on an asp page. I have tried moving the code near the header to the footer, but that does not seem to make any difference. I suppose that it was worth the try. Does anyone know of a solution which would be able to use code on the same asp page. I would like to avoid using an adjacent page or folder. Thank you for all suggestions...Stephan in Ottawa
 
Joined
Jan 18, 2004
Messages
3,552
There's a lot of discussion about ASP in the Web Development forum. If you don't get an answer here, click on the red triangle and ask one of the Mods to move your inquiry there.
 

stephanlh

Thread Starter
Joined
Jul 6, 2005
Messages
5
Dear Mr. Smeegle,

Thanks for the suggestion. I suppose that I should have done that in the first place, but working in front of a computer screen on a daily basis seems to dull my use of simple logic. Best wishes...Stephan
 
Joined
Jul 29, 2001
Messages
21,334
Just write a function to format the date the way you want it.

<% Dim strDay, strMonth, strYear
Dim strEuroDte
strDay = DatePart("d", Date)
strMonth = DatePart("m", Date)
strYear = DatePart("yyyy", Date)
strEuroDte = strYear & "-" & strMonth & "-" & strDay

%>
<%= strEuroDte %>

You can call this from an include like you were doing as well.
 

stephanlh

Thread Starter
Joined
Jul 6, 2005
Messages
5
Dear Rockn,

I can not quite get things to work. Do you mean this code right after the line Date modified as in:

Last updated:
<% Dim strDay, strMonth, strYear Dim strEuroDte
strDay=DatePart("d", Date) strMonth=DatePart("m", Date) strYear=DatePart("yyyy", Date) strEuroDate=strYear & "-" & strMonth & "-" strDay%>
<%=strEuroDate%>

For some reason I get the message that the page can not be displayed.
Thanks for all and every kind of help.

Stephan in Ottawa
 
Joined
Jul 29, 2001
Messages
21,334
Are you uploading it to your web host or trying to view it locally? If the page will not load your web host or test server doesn't support ASP.
 

stephanlh

Thread Starter
Joined
Jul 6, 2005
Messages
5
Yes, we have other ASP pages on our server, in fact quite a few as it is a large server. The problem is more so that I could not get the code which I had initially used on the HTML pages to work on the ASP pages for the automated date update. The idea is that whenever someone makes a change the date is changed to the date on which the last change was made. It works perfectly with HTML <!-- #echo var="Last Modified"--> , but not with ASP. I will try your code again. I might be using it wrongly. I am trying to use it on the same page. May be I have to use it in a separate page and call it in which is not really what I want. The nice thing about the code <!-- #echo var="Last Modified"--> is that it can be placed on the very page concerned just after the words: Last Updated:

Thanks for your help and any suggestion...Stephan in Ottawa
 
Joined
Jul 29, 2001
Messages
21,334
I have a feeling that what you were running before was .Net and not standard HTML pages to call these variables. I would also assume that the current server does not have the .Net framework installed otherwise your original Echo to the variable would work.

BTW, have you recently moved from an Apache environment on a unix server?
 

stephanlh

Thread Starter
Joined
Jul 6, 2005
Messages
5
I will have to contact the server people to ask these questions. You might be right. Thanks again...Stephan in Ottawa
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top