Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
How can we display only selected day (wednesday) in calender by java script. Simply when we click on calender it show only wednesday(& its date suppose 1,8,15,23,30).I solve this by selected date but my client needs it day wise. I would really appreciate if anyone help me. Kindly gives me suggestion as much as possible. Thanks in advance.
Posted

1 solution

Hi Mas11,

Please check following link
jQuery Datepicker: Disable specific weekdays[^]

Following are the code:
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/themes/base/jquery-ui.css">
        type="text/css" media="all" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js">
        type="text/javascript"></script></link>

JavaScript
<script type="text/javascript">
    $(function () {

        // 0 = monday, 1 = tuesday, 2 = wednesday, 3 = thursday,
        // 4=friday, 5 = saturday, 6=sunday

        var daysToDisable = [2, 4, 5];

        $('#<%= txtDate.ClientID  %>').datepicker({
            beforeShowDay: disableSpecificWeekDays
        });

        function disableSpecificWeekDays(date) {
            var day = date.getDay();
            for (i = 0; i < daysToDisable.length; i++) {
                if ($.inArray(day, daysToDisable) != -1) {
                    return [false];
                }
            }
            return [true];
        }
    });
</script>

ASP.NET
<body>
    <form id="form1" runat="server">
    <asp:textbox id="txtDate" runat="server" xmlns:asp="#unknown"></asp:textbox>
    </form>
</body>


Please do let me know, if you have any issue.
Thanks,
Imdadhusen
 
Share this answer
 
Comments
Mas11 29-May-12 8:30am    
A wonderfull thanks to my bro, i was searching over this from last 3 days, but finally you creates smile on my face. Again thanks a lot.
Sunasara Imdadhusen 29-May-12 8:36am    
if this is accepted solution for you, then please make it correct answer for more appreciation for me.

Thanks,
Imdadhusen
Mas11 29-May-12 8:38am    
ok....
Mas11 30-May-12 2:46am    
hi Imdadhusen,
there is small issue, thats the date format comes in mm/dd/yyyy but i need dd/mm/yyyy. I saw its java script file its too lengthy to search. So can you tell me how i change date format.
Mas11 30-May-12 3:04am    
I do it bro.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900