MyBB Community Forums

Full Version: Day Of The Week [JavaScript]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey Guys,

I Need A Simple Javascript...

I Want To Write Something About Day Of The Week.

[Like: If Day Is Monday, I Want To Write; Good Mondays! Today Is .........]

Is There Anybody Who Have A Script Like What I Want ???
I cannot take any of the credit for this script, it is from open-realty
<!-- Date and time script  -->
			 <script type="text/javascript">
				<!-- Begin
				var days=new Array(7);
				days[1]="Monday";
				days[2]="Tuesday";
				days[3]="Wednesday";
				days[4]="Thursday";
				days[5]="Friday";
				days[6]="Saturday";
				days[0]="Sunday";
				var months=new Array(13);
				months[1]="January";
				months[2]="February";
				months[3]="March";
				months[4]="April";
				months[5]="May";
				months[6]="June";
				months[7]="July";
				months[8]="August";
				months[9]="September";
				months[10]="October";
				months[11]="November";
				months[12]="December";
				var time=new Date();
				var ldays=days[time.getDay()];
				var lmonth=months[time.getMonth() + 1];
				var date=time.getDate();
				var year=time.getYear();
				if (year < 2000)
				year = year + 1900;
				document.write(ldays + "," + " " + lmonth + " " + date + "," + " " + year);
				// End
				// -->
				</script>
I *think* this will get you pretty close to what you are looking for though.