time to hours and minuts

2 posts, 0 answers
  1. beeta one
    beeta one avatar
    63 posts
    Member since:
    Aug 2012

    Posted 05 Nov 2012 Link to this post

    how can i change the time to hours and minuts instead of showing only the hours in raddatetime picker?
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 05 Nov 2012 Link to this post

    Hi Hash,

    One suggestion is to use the following code snippet to achieve your scenario.

    <telerik:RadDateTimePicker ID="RadDateTimePicker1" runat="server">
      <TimeView ID="TimeView1" runat="server">
          <asp:DropDownList ID="HoursDropDownList" runat="server">
             <asp:ListItem Text="1" />
             <asp:ListItem Text="2" />
             <asp:ListItem Text="3" />
          <asp:DropDownList ID="MinutesDropDownList" runat="server">
             <asp:ListItem Text="1" />
             <asp:ListItem Text="2" />
             <asp:ListItem Text="3" />
          <br />
          <br />
          <asp:Button ID="Button1" runat="server" OnClientClick="return ApplyTime()" Text="Apply Time" />

    <script type="text/javascript">
        function clearClickHandler() {
            var tv = $find("<%= RadDateTimePicker1.ClientID %>").get_timeView();
            if (tv._onCellMouseOutDelegate) {
                $removeHandler(tv.DivElement, "mouseout", tv._onCellMouseOutDelegate);
                tv._onCellMouseOutDelegate = null;
            if (tv._onCellMouseOverDelegate) {
                $removeHandler(tv.DivElement, "mouseover", tv._onCellMouseOverDelegate);
                tv._onCellMouseOverDelegate = null;
            if (tv._onCellClickDelegate) {
                $removeHandler(tv.DivElement, "click", tv._onCellClickDelegate);
                tv._onCellClickDelegate = null;
        function ApplyTime() {
            var picker = $find("<%= RadDateTimePicker1.ClientID %>");
            var pd = picker.get_selectedDate();
            if (!pd) {
                pd = new Date();
            pd.setHours(parseInt($get("<%= RadDateTimePicker1.ClientID %>_timeView_tdl_ctl01_HoursDropDownList").value));
            pd.setMinutes(parseInt($get("<%= RadDateTimePicker1.ClientID %>_timeView_tdl_ctl01_MinutesDropDownList").value));
            return false;

    protected void Page_Load(object sender, EventArgs e)
            RadDateTimePicker1.TimeView.DataList.DataSource = new DateTime[1];

    Hope this helps.

  3. DevCraft R3 2016 release webinar banner
Back to Top