Auto year format

2 posts, 0 answers
  1. Monisha
    Monisha avatar
    2 posts
    Member since:
    Feb 2015

    Posted 20 Mar 2015 Link to this post

    In the Date Picker control. I want year to be custom format.

    For example:

    In the year field i want to type 15 and press tab it should auto populate 2015.

    Is it possible?

    Thanks in Advance. 
  2. Nasko
    Admin
    Nasko avatar
    585 posts

    Posted 25 Mar 2015 Link to this post

    Hello Monisha,

    RadDatePicker control provides the possibility to modify the way the date is formatted and apply a custom format if needed. Please, check the following article from our help documentation that provides a detailed information how to achieve this:
    http://docs.telerik.com/devtools/silverlight/controls/raddatetimepicker/features/formatting

    For you concrete scenario you could apply the following format:
    this.radDateTimePicker.Culture = new System.Globalization.CultureInfo("en-US");
    this.radDateTimePicker.Culture.DateTimeFormat = new System.Globalization.DateTimeFormatInfo
    {
        ShortDatePattern = "yy",
        LongDatePattern = "yyyy"
    };

    Also, the ParseExact property should be set to "True" and the DisplayFormat property to "Long":
     
    <telerik:RadDatePicker x:Name="radDateTimePicker" ParseExact="True" DisplayFormat="Long"/>

    Thus the date could be entered in its short format and be displayed in the long format.

    We hope this will help you.

    Regards,
    Nasko
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. DevCraft banner
Back to Top