Quick fix date script please help

sm00thtalker80

OSNN One Post Wonder
#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 posts

Latest profile posts

Perris Calderon wrote on Electronic Punk's profile.
Ep, glad to see you come back and tidy up...did want to ask a one day favor, I want to enhance my resume , was hoping you could make me administrator for a day, if so, take me right off since I won't be here to do anything, and don't know the slightest about the board, but it would be nice putting "served administrator osnn", if can do, THANKS

Been running around Quora lately, luv it there https://tinyurl.com/ycpxl
Electronic Punk wrote on Perris Calderon's profile.
All good still mate?
Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,969
Messages
673,295
Members
89,015
Latest member
arrangel