Find Second and Fourth Saturday for the selected month and year using this javascript.
Features
a) Use this java script to find second and fourth saturday of particular month and year.
b) This code supports all browsers.
Preview
Finding Second and Fourth Saturday
Code
Javascript
<!-- Script by hscripts.com -->
<script type="text/javascript">
function calculate()
{
var mon=document.getElementById('month').value;
var yea=document.getElementById('year').value;
var dat=1;
myDays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
myDate=new Date(eval('"'+dat+','+mon+','+yea +'"'))
var first=myDays[myDate.getDay()];
var secnd;
var forth;
switch(first)
{
case "Sunday":
secnd = "14th,"+mon+','+yea;
forth = "28th,"+mon+','+yea;
break;
case "Monday":
secnd = "13th,"+mon+','+yea;
forth = "27th,"+mon+','+yea;
break;
case "Tuesday":
secnd ="12th,"+mon+','+yea;
forth = "26th,"+mon+','+yea;
break;
case "Wednesday":
secnd = "11th,"+mon+','+yea;
forth = "25th,"+mon+','+yea;
break;
case "Thursday":
secnd = "10th,"+mon+','+yea;
forth = "24th,"+mon+','+yea;
break;
case "Friday":
secnd = "9th,"+mon+','+yea;
forth = "23rd,"+mon+','+yea;
break;
case "Saturday":
secnd = "8th,"+mon+','+yea;
forth = "22nd,"+mon+','+yea;
break;
default:
break;
}
document.getElementById('secsat').value = secnd;
document.getElementById('foursat').value = forth;
}
function ctck()
{
var sds = document.getElementById("dum");
if(sds == null){
alert("You are using a free package.\n You are not allowed to remove the tag.\n");
}
var sdss = document.getElementById("dumdiv");
if(sdss == null){
alert("You are using a free package.\n You are not allowed to remove the tag.\n");
}
}
document.onload ="ctck()";
</script>
<!-- Script by hscripts.com -->
For customization of this script or any script development, contact us at support@hscripts.com
Usage
a) Copy and paste the javascript code into your file.
b) Execute the code.
c) Select month and year using drop down list and then click "submit" button.
d) Simple and Easy to find second and fourth saturday in a month.
License
- The javascript (misspelled as java script) is given under GPL License
- i.e. Free use for those who use the codes as it is.
- Free, if your modification does not remove our copyright information and links.
- Click Here for detailed license information.
- You can purchase the script if your requirements does not meet our GPL License terms.