Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi ,

I am using bootstrap datetimeoicker for generating calender control for my DOB textbox

There are two issues happening

1. I want only date but this generates with time as well.
2. This works very odd on chrome , genarting 2 different calenders and even after clicking on calender icon i am not able to select dates from there.

Please help


<script type="text/javascript">
    $(document).ready(function () {
        bindDatePicker();
        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(bindDatePicker);
    });

    function bindDatePicker() {
        $('.picker').datetimepicker({
            language: 'fr',
            weekStart: 1,
            todayBtn: 1,
            autoclose: 1,
            todayHighlight: 1,
            startView: 2,
            minView: 2,
            forceParse: 0,
            pickTime: false
        });
    }
</script>


ASP.NET
<div class="form-group">
                          <label for="smallinput" class="col-sm-2 control-label label-input-sm">DOB</label>
                          <div class="input-group date  col-sm-8 picker" id='datetimepicker1'>
                              <asp:TextBox TextMode="Date" ID="txtDOB" runat="server" CssClass="form-control1 input-sm"></asp:TextBox>
                              <asp:RequiredFieldValidator ID="RequiredFieldValidator13" Display="None" runat="server" ErrorMessage="DOB is required." ControlToValidate="txtDOB" ValidationGroup="Save"></asp:RequiredFieldValidator>
                              <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
                              <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
                          </div>
                          <input type="hidden" id="dtp_input2" value="" /><br />
                      </div>
Posted
Updated 8-Jan-16 9:22am
v2
Comments
ZurdoDev 8-Jan-16 15:14pm    
I don't know this control but you can easily strip times off of dates.
Maciej Los 8-Jan-16 15:37pm    
DataTimePicker should have to have Format property. Check it out!

1 solution

Take a look here: Datepicker Widget | jQuery UI API Documentation[^] and here: Bootstrap 3 Datepicker[^]
declaration:
$.datepicker.formatDate( format, date, options )
initiation:
$.datepicker.formatDate( "yy-mm-dd", new Date( 2007, 1 - 1, 26 ) );
 
Share this answer
 
v2

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