Full day in clock items

5 posts, 1 answers
  1. Jakkie Esschert van den
    Jakkie Esschert van den avatar
    61 posts
    Member since:
    Sep 2009

    Posted 10 Oct 2011 Link to this post

    Hi,

    I'm using a DateTimePicker in TimePicker mode to select a duration. I've set my own clockitems to provide a set of predefined durations, which work fine. However, I'd like to provide a 24:00 hour clock item as well which I can't get to work. When I set the EndTime to 24:00 a timespan of 24 hours does get added to the clock items, however it is displayed as 0:00 and when selected a 0:00 timespan is returned.

    Is there a way around this? I can work around the fact that 24:00 gets converted to 0:00, but I can't find a way to make the drop down display 24:00 for the largest item.
  2. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 11 Oct 2011 Link to this post

    Hi Jakkie,

    You can affect the format of the displayed time or date in the RadDateTimePicker only through setting the Culture. You can find more information about the CultureInfo class here.

    Hope this information helps.

    Kind regards,
    Konstantina
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. DevCraft banner
  4. Jakkie Esschert van den
    Jakkie Esschert van den avatar
    61 posts
    Member since:
    Sep 2009

    Posted 11 Oct 2011 Link to this post

    The thing is that I can't use the culture because it can't be configured to display a TimeSpan of one day as 24:00. But even if I could, a one day TimeSpan becomes a zero timespan internally in the DateTimePicker.
    I realize I'm trying to stretch the possibilities of the DateTimePicker here, as I'm not actually selecting a time but a Duration. However, when selecting a duration offering a 24 hour duration seems a reasonable use case to me. Perhaps there should be a DurationPicker...
  5. Answer
    Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 12 Oct 2011 Link to this post

    Hi Jakkie,

    You could try to implement the custom parsing. You can find more information about it in this help article.
    Alternately, you could use the RadComboBox. It is much more flexible, you could set the ItemsSource to hours and you could customize it so that it looks more like the TimePicker. You can view its demos here.

    Regards,
    Konstantina
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  6. Jakkie Esschert van den
    Jakkie Esschert van den avatar
    61 posts
    Member since:
    Sep 2009

    Posted 12 Oct 2011 Link to this post

    I'll take a look at both options. Thanks for the help.
Back to Top
DevCraft banner