Find Today is Sunday or Not by Jquery


Wednesday, August 3, 2011


Hello Friends,

Please find below demo and code to find date is sunday or not, please check it out.


Demo



Year : (only interger)

Month : (only interger)

Date : (only interger)






<html>
<head>
<title>jQuery test page</title>
<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>

<script type="text/javascript">

function getsunday(date) {
        var day = date.getDay();
        return [(day != 0), ''];
    }


function FindTodayisSunday() {
            if(getsunday(new Date(document.getElementById('txtyear').value,document.getElementById('txtmonth').value-1,document.getElementById('txtdate').value))!='true,'){
            document.getElementById('error').innerHTML="Today is sunday.";
            document.getElementById("error").setAttribute("style", "color:Green;"); 
            }
            else{
            document.getElementById('error').innerHTML="Today is not sunday";
            document.getElementById("error").setAttribute("style", "color:Red;"); 
            }
}
</script>
</head>
<body>
Year : <input type="text" id="txtyear"/><i>(only interger)</i><br />
Month : <input type="text" id="txtmonth"/><i>(only interger)</i><br />
Date : <input type="text" id="txtdate" onblur="FindTodayisSunday()" /><i>(only interger)</i><br />
<span id="error"></span>
</body>
</html>




Thanks
Hope this post will help you,
if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer
Email: raj143svmit@gmail.com
e-Procurement Technologies Ltd (India)
www.abcprocure.com

No comments :