»
EnglishFrenchVietnamese

Print - Day Counter script - JavaScriptBank.com

Full version: jsB@nk » Time » Counter » Day Counter script
URL: https://www.javascriptbank.com/day-counter-script.html

Day Counter script © JavaScriptBank.comIf you've ever wondered how many wednesdays there are in the current month, this script will tell you that. It can be modified to work with any day of the week, if not all of them together!

Full version: jsB@nk » Time » Counter » Day Counter script
URL: https://www.javascriptbank.com/day-counter-script.html



HTML
<SCRIPT LANGUAGE="JavaScript">// Michael Mann , http://www.manninc.comvar now = new Date();var month = now.getMonth();var date = now.getDate();var day = now.getDay();var year = now.getYear();m = new Array("January","February","March","April","May","June","July","August","September","October","November","Decemeber");d = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");if (year < 2000) year = year + 1900;//End of Month Calculationsvar monarr = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);// check for leap yearif (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) monarr[1] = "29";//Finds the First Day for the Current Monthwhile (date != 1){date = date - 1;day = day - 1;if (day < 0) day = day + 7;}//Counts Number of Wednesdays in the Current Monthweekday = 0;while (date != monarr[month]){date = date + 1;day = day + 1;if (day > 6)day = 7 - day;if (d[day] == "Wednesday")weekday = weekday + 1;}//Fix For Months beginning on a Wednesdayif (d[day] == "Wednesday") weekday = weekday + 1;document.write (m[month] + " contains " + weekday + " " + d[3] + "s");</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->