Date/time script help, (i'm retarded)

Status
Not open for further replies.

Transplant

not by choice
Mar 17, 2007
135
2
0
Redneckville
I have a static website featuring articles that never get updated. I'm trying to make it look like it's being updated every day or other day by placing dates that change on the top of the articles. I've tried to combine these scripts with no avail.

[FONT=Verdana, Arial, Helvetica][/FONT]
Code:
<SCRIPT>
// Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/
var mydate=new Date()
var theYear=mydate.getFullYear()
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
document.write(dayarray[day]+", "+montharray[month]+" "+daym+", "+theYear)
</SCRIPT>

and this variable is supposed to let you change the current date to 1 or more days in the past

Code:
var myDate=new Date();
myDate.setDate(myDate.getDate()-1);
If someone can combine these to crap out a date that is always one or twos days ago I would be very grateful.

- Transplant
 


Here you go
<SCRIPT>
// Courtesy of SimplytheBest.net - SimplytheBest Scripts
var mydate=new Date()
mydate.setDate(mydate.getDate()-2);
var theYear=mydate.getFullYear()
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
document.write(dayarray[day]+", "+montharray[month]+" "+daym+", "+theYear)
</SCRIPT>
 
  • Like
Reactions: Transplant
Status
Not open for further replies.