Timepicker 00:00-24:00

12 posts, 0 answers
  1. Corey Alguire
    Corey Alguire avatar
    43 posts
    Member since:
    Sep 2004

    Posted 04 Jul 2008 Link to this post

    I realize this may sound like a slightly strange question, but I was wondering if it is possible to show 00:00-24:00 in the TimePicker. At the moment, I cannot find anyway to include both 00:00 at the beginning and 24:00 at the end. I have a scenario where I need this for a client, and I was hoping to be able to accomplish it with the Rad TimePicker rather than the drop-down lists I inherited from the previous developer.
  2. Plamen Peshev
    Admin
    Plamen Peshev avatar
    886 posts

    Posted 08 Jul 2008 Link to this post

    Hi Corey Alguire,

    The following code example demonstrates how to achieve your goal:

    <%@ Page Language="C#" %> 
     
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml"
    <head runat="server"
        <title>Untitled Page</title> 
        <script runat="server"
            protected void Page_Load(object sender, EventArgs e) 
            { 
                RadTimePicker1.TimeView.StartTime = new TimeSpan(0, 0, 0, 0); 
                RadTimePicker1.TimeView.EndTime = new TimeSpan(1, 0, 0, 1); 
            }     
        </script> 
    </head> 
    <body> 
        <form id="form1" runat="server"
            <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
            <div> 
                <telerik:RadTimePicker ID="RadTimePicker1" runat="server"
                    <TimeView TimeFormat="HH:mm:ss"></TimeView> 
                </telerik:RadTimePicker> 
            </div> 
        </form> 
    </body> 
    </html> 
     


    Best wishes,
    Plamen
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mats
    Mats avatar
    66 posts
    Member since:
    Aug 2006

    Posted 20 Nov 2009 Link to this post

    Hi!

    I have a need for my users to be able to type 00:00 to 24:00 into the input field.
    Typing 24:00 really means 00:00 next day.

    When I type 24:00 in the input field some validator is saying that it is not valid.

    Is there a way to override this functionality?

    Thanks
    /Mats
  5. Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 20 Nov 2009 Link to this post

    Hi Mats,

    Well, 24:00 is not really a valid time, so it is not supported, sorry.

    I suggest you to make your users select 00:00 with the next day's date.

    Best wishes,
    Dimo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Casey
    Casey avatar
    299 posts
    Member since:
    Jul 2009

    Posted 24 Nov 2009 Link to this post

    Hi Dimo,

    I know that 24:00 is not a valid time and not supported, but would it be possible to check the value in the Date Input on some event (like Text Changed) and then switch from 24:00 to 00:00 of the next day with code?

    Casey
  7. Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 25 Nov 2009 Link to this post

    Hello Casey,

    Since you want to add a date information to the selected time, the more reasonable option is to use a RadDateTimePicker.

    Alternatively, you can use the following approach. The important thing is to set a DateFormat for the DateInput control, which contains the date information. Otherwise the date information coming from the TimeView will be stripped and today's date will be applied in the end.


    <%@ Page Language="C#" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
     
        <script runat="server">
             
            protected void Page_Load(object sender, EventArgs e)
            {
                DateTime[] dtArray = new DateTime[25];
                DateTime startTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0);
                for (int hours = 0; hours < 25; hours++)
                    dtArray[hours] = startTime.AddHours(hours);
                 
                RadTimePicker1.TimeView.DataList.DataSource = dtArray;
            }
             
        </script>
      
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
     
    <head id="Head1" runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
     
    <telerik:RadTimePicker ID="RadTimePicker1" runat="server" Width="200px">
        <TimeView TimeFormat="HH:mm" />
        <DateInput DateFormat="yyyy/MM/dd HH:mm:ss" />
    </telerik:RadTimePicker>
     
    </form>
    </body>
    </html>



    All the best,
    Dimo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  8. Casey
    Casey avatar
    299 posts
    Member since:
    Jul 2009

    Posted 27 Nov 2009 Link to this post

    Hi Dimo,

    In my question I mistakenly put Date Input when I really meant Time Input. My question goes along the same lines as Mats question though. Since he has a requirement to allow 00:00 through 24:00 (which is really 00:00 next day) to be entered into the Time Input, but the validator on the TimePicker control doesn't allow this, would it be possible to somehow cancel the validaton or force the validation to be ok? Or would it be possible in the TextChanged event of the TimeInput to implement logic to reset the time to 00:00 and change some flag that indicates whether or not 24:00 was entered?

    Casey
  9. Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 27 Nov 2009 Link to this post

    Hello Casey,

    We do not have a "TimeInput" control, what do you mean by that?

    Also, did you test the simple example from my previous post? What is the difference between that example and your requirement?

    Kind regards,
    Dimo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  10. Casey
    Casey avatar
    299 posts
    Member since:
    Jul 2009

    Posted 27 Nov 2009 Link to this post

    Dimo,

    What I meant by TimeInput is the input part of the RadTimePicker. I guess when I mentioned 'DateInput' in my first post that I had the correct name. I'm not asking a different question from Mats question. I'm just curious if there is a way  for Mats to achieve what he is asking by allowing the users to enter 24:00 into the Input section of the RadTimePicker without the control saying it is not valid.

    Casey 
  11. Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 27 Nov 2009 Link to this post

    Hi Casey,

    The TimePicker uses a DateInput as its textbox - it's just the name of the control. I am afraid that the DateInput will not accept 24:00 as a valid value under any circumstances and will not keep it.

    Sincerely yours,
    Dimo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  12. Rob
    Rob avatar
    59 posts
    Member since:
    Jan 2012

    Posted 17 Aug Link to this post

    Damn.. just what I also need..

    I'm guessing no progress on this one so maybe I need to remove all my time pickers and find another solution :(

     

  13. Eyup
    Admin
    Eyup avatar
    3005 posts

    Posted 19 Aug Link to this post

    Hi Rob,

    Perhaps setting custom values within the TimeView will prove helpful for this specific requirement:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/timepicker/functionality/configuring-the-embedded-time-view#radtimepicker-custom-values

    Regards,
    Eyup
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017