DateTimeFormat

6 posts, 0 answers
  1. Alexandru
    Alexandru avatar
    16 posts
    Member since:
    Nov 2012

    Posted 21 Mar 2013 Link to this post

    Hi!

    I am trying to customize a DateTimePicker to show the whole date and time in a custom format.
    I found a way to customize the ShortdatePattern and the shorttimePattern separatly, but I would really require the FullDateTimePattern to work, as I have the format in a string (date and time combined) and I don't want to split it. I am using Q12013 WFP RadDateTimePicker

                dtp.SelectedValue = DateTime.Now;
                dtp.Culture = new CultureInfo("")
                                  {
                                      DateTimeFormat =
                                          {
                                              FullDateTimePattern = "yyyy : MM : dd HH mm ss", //doesn't work
                                              ShortDatePattern = "yyyy : MM : dd", //works
                                              ShortTimePattern = "tt hh::mm::ss", //works
                                          },
                                  };

    Thanks in advance,
    Alex
  2. Alek
    Admin
    Alek avatar
    78 posts

    Posted 26 Mar 2013 Link to this post

    Hello Alexandru,

    In the current version of the RadDateTimePicker there is no way to set a custom format using FullDateTimePattern.

    Unfortunately, we cannot provide you with a workaround for the scenario and if you want to customize the DateTimeFormat you should use ShortDatePattern, ShortTimePattern, LongDatePattern and LondTimePattern instead.

    Regards,
    Alek
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Alexandru
    Alexandru avatar
    16 posts
    Member since:
    Nov 2012

    Posted 27 Mar 2013 Link to this post

    Thanks!

    Could you please tell me if in the next version, 2013Q2, will this feature be implemented?

    Alexandru
  5. Alek
    Admin
    Alek avatar
    78 posts

    Posted 29 Mar 2013 Link to this post

    Hello,

    We haven't considered implementing the feature for Q2 2013 so far. 

    Could you please share us more information about the scenario in your project and  what difficulties you are facing using the current implementation?

    Greetings,
    Alek
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Alexandru
    Alexandru avatar
    16 posts
    Member since:
    Nov 2012

    Posted 01 Apr 2013 Link to this post

    Hi!

    Customising the datetimepicker format requires the user to alter the Culture object. This object, among other properties, has these 3 formats: FullDateTimePattern, ShortDatePattern and ShortTimePattern.
    I think that the control should be able to take into consideration the format from all these 3 properties. If not, than it should have 2 separate properties ShortDatePattern and ShortTimePattern and not give the user the impression it can handle full formatting.
    If you consider an application that has a datetimeformat preference as a string, it is not that obvious to extract from it the date and the time formats, taking into consideration that they can appear in any order.
    Or can this be done differently?

    Thanks,
    Alexandru




  7. Alek
    Admin
    Alek avatar
    78 posts

    Posted 04 Apr 2013 Link to this post

    Hi Alexandru,

    Thank you for your feedback.

    We are using the DateTimeFormatInfo object for both formatting and parsing the current value. As you correctly noticed this class has a series of properties holding overlapping information like FullDateTimePattern, LongDatePattern, LongTimePattern, ShortTimePattern, ShortDatePattern, SortableDateTimePattern and etc. As we cannot use all of them we decided to use the most comfortable ones for us which are the separate date and time patterns (LongDatePattern, LongTimePattern, ShortTimePattern, ShortDatePattern). They make it easier for us to parse the text written by the user. We decided to use both short and long patterns and to expose a property which allows the user to choose which pair to be used.

    Kind regards,
    Alek
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
UI for WPF is Visual Studio 2017 Ready