Display DateTime in custom format (ICustomerFormatter)

3 posts, 1 answers
  1. jbssa
    jbssa avatar
    6 posts
    Member since:
    Sep 2010

    Posted 24 Sep 2010 Link to this post

    Hi,

    I use the RadDatePicker to let the user select a date. Instead of displaying the whole date, only the year and the quarter should be displayed then. I thought of an ICustomerFormatter and IFormatProvider to write a new custom format for the quarter portion of the date. So I have to pass my own format provider to the control. How do I do that? I tried to overwrite RadDatePicker but this seems not enough, because the input control itself is a RadDatePicker-Control.
    Any ideas to start with, or is it just the wrong way to achieve the displaying of my own custom format?
  2. Answer
    Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 29 Sep 2010 Link to this post

    Hi jbssa,

    The DateFormatString of the RadDateInput/RadDatePicker should have all the day, month and year parts. You can use the DisplayDateFormatString property to specify how date would look when the control is out of focus. If this is not applicable for your case, you would better use regular textbox control with RadCalendar for picking dates.

    Additionally, you can refer to the below code library projects for further alternatives:
    http://www.telerik.com/community/code-library/aspnet-ajax/calendar/how-to-use-raddatepicker-with-a-quot-mm-yyyy-quot-formatted-dateinput.aspx
    http://www.telerik.com/community/code-library/aspnet-ajax/calendar/replace-the-dateinput-component-of-r-a-d-datepicker-with-regular-asp-textbox.aspx

    All the best,
    Iana
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. jbssa
    jbssa avatar
    6 posts
    Member since:
    Sep 2010

    Posted 30 Sep 2010 Link to this post

    Thanks for your reply Iana. I used your suggested solutions with a seperate textfield and display the selected date there with some formatting options.

    Thanks!

    lG
    Jens
Back to Top