Quick fix date script please help

sm00thtalker80

OSNN One Post Wonder
Joined
27 May 2004
Messages
1
I'm having trouble running this script. My goal is to display a date depending on todays date. For ex. If today is Monday June 7, or Tues. June 8, or Wed. June 9 - I would like the text to display Wednesday June 9. In the 1st script below I can get the script to display 3 dates, which is the 1st basic part of the script but when I try " if " , " else " statements I cant get the script to display correctly as shown in the 2nd script below. I think this will be a simple quick fix but I've racked my brain and can't seem to figure it out. please help...Thanks

1st.

<script type="text/javascript">
var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var monthname=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
var today = new Date()
var todayInMS = today.getTime()
var inonedays = todayInMS + (60 * 60 * 24 * 0 * 1000)
var intwodays = todayInMS + (60 * 60 * 24 * 1 * 1000)
var inthreedays = todayInMS + (60 * 60 * 24 * 2 * 1000) //
var newdate = new Date(inonedays)
var newdate1 = new Date(intwodays)
var newdate2 = new Date(inthreedays)


document.write("<br>" + weekday[newdate.getDay()] + ", ")
document.write(monthname[newdate.getMonth()] + " ")
document.write(newdate.getDate() + " ")

document.write("<br>" + weekday[newdate1.getDay()] + ", ")
document.write(monthname[newdate1.getMonth()] + " ")
document.write(newdate1.getDate() + " ")

document.write("<br>" + weekday[newdate2.getDay()] + ", ")
document.write(monthname[newdate2.getMonth()] + " ")
document.write(newdate2.getDate() + " ")
//document.write(newdate.getFullYear())
</script>

2nd.

<script type="text/javascript">
var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var monthname=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
var today = new Date()
var todayInMS = today.getTime()
var inonedays = todayInMS + (60 * 60 * 24 * 0 * 1000)
var intwodays = todayInMS + (60 * 60 * 24 * 1 * 1000)
var inthreedays = todayInMS + (60 * 60 * 24 * 2 * 1000) //
var newdate = new Date(inonedays)
var newdate1 = new Date(intwodays)
var newdate2 = new Date(inthreedays)

if // eg. if today is Monday June 7 - text will display Wednesday June 9
weekday==("Monday","Thursday")
{
document.write(weekday[newdate2.getDay()] + ", ")
document.write(monthname[newdate2.getMonth()] + " ")
document.write(newdate2.getDate() + " ")
}

if
weekday==("Tuesday","Friday")
{
document.write(weekday[newdate1.getDay()] + ", ")
document.write(monthname[newdate1.getMonth()] + " ")
document.write(newdate1.getDate() + " ")
}

if
weekday==("Sunday","Wednesday","Saturday")
{
document.write(weekday[newdate.getDay()] + ", ")
document.write(monthname[newdate.getMonth()] + " ")
document.write(newdate.getDate() + " ")
}

</script>

Thank you for your time.

Brian
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,496
Members
5,625
Latest member
vinit
Back