Thread: yesterday's date in a link?
Results 1 to 7 of 7
Related
-
Adding a date Forum: Website Scripts Forum
Replies: 1 -
Getting todays date with javascript Forum: Javascript Forum
Replies: 3 -
order by date Forum: PHP Forum
Replies: 10 -
Java Date Forum: Javascript Forum
Replies: 3 -
Date Validation Forum: HTML Forum
Replies: 7
-
11-05-2006, 07:59 PM #1
yesterday's date in a link?
I have read the thread showing how to display todays date ( http://www.ahfb2000.com/webmaster_he...read.php?t=556 )but what I am looking for is a little bit different. How do I add yesterdays date to a link (like below):
<a href="http://mytext.com/11052006.txt"> click here to download yesterday's text</a><br>
I would put 3 days on there - today, yesterday, and day before yesterday and have it update every day.
Thanks!!!
-
11-05-2006, 08:39 PM #2
Re: yesterday's date in a link?
try this:
Code:var futdate = new Date() var expdate = futdate.getTime() expdate -= 86400*1000 //expires in 1 hour(milliseconds) //alert(expdate); futdate.setTime(expdate) alert(futdate);
-
11-05-2006, 09:52 PM #3
Re: yesterday's date in a link?
Originally Posted by ALL
-
11-06-2006, 12:26 AM #4
Re: yesterday's date in a link?
oh well i figured you knew javascript a little...
then try this:
Code:var expdate = futdate.getTime() expdate -= 86400*1000 //expires in 1 hour(milliseconds) //alert(expdate); futdate.setTime(expdate) //alert(futdate); var a = document.createElement('a'); a.href = "http://www.google.com/"+futdate; a.title = futdate; a.innerHTML ="CLICK HERE!"; document.getElementsByTagName('body')[0].appendChild(a);
-
11-06-2006, 10:38 AM #5
Re: yesterday's date in a link?
I added the text below to my html and it doesn't do anything (nothing shows up on the page):
<script language="JavaScript">
var expdate = futdate.getTime()
expdate -= 86400*1000 //expires in 1 hour(milliseconds)
//alert(expdate);
futdate.setTime(expdate)
//alert(futdate);
var a = document.createElement('a');
a.href = "<A href="http://www.google.com/"+futdate">http://www.google.com/"+futdate;
a.title = futdate;
a.innerHTML ="CLICK HERE!";
document.getElementsByTagName('body')[0].appendChild(a);
</script>
-
11-07-2006, 12:02 AM #6
Re: yesterday's date in a link?
Originally Posted by rmcelwee
second off... i missed the first line of code (probably when i copied and pasted it).
here is the code this time...
HTML Code:<html> <head> </head> <body> <script language="JavaScript"> var futdate = new Date() var expdate = futdate.getTime() expdate -= 86400*1000 //expires in 1 hour(milliseconds) //alert(expdate); futdate.setTime(expdate) //alert(futdate); var a = document.createElement('a'); a.href = 'http://www.google.com/'+futdate; a.title = futdate; a.innerHTML ="CLICK HERE!"; document.getElementsByTagName('body')[0].appendChild(a); </script> </body> </html>
-ALL
-
11-07-2006, 08:57 AM #7
Re: yesterday's date in a link?
Close, but it doesn't get me in my needed format. It contains the time, day of the week, EST, and some other stuff. Thanks though, I appreciate it!
<a href="http://mytext.com/11052006.txt"> click here to download yesterday's text</a><br>