This is a migrated thread and some comments may be shown as answers.

How to not have the year on a DatePicker

1 Answer 26 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Siham asked on 18 Mar 2019, 08:31 AM

Hi All,

I am now trying to have a DatePicker without the year on the TextBlock (only day and month).

I've tried to use StringFormat by puting it on 'dd/MMMM' but it doesn't work.

my code is the following:

<telerik1:RadDatePicker Width="150" x:Name="DatePickerRevision" SelectedDate="{helpers:CultureAwareBinding Model.BauxInfo.DateDerniereRevision,     Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, StringFormat='dd/MMMM'}" IsTabStop="True"     
    ErrorTooltipContent="{helpers:CultureAwareBinding ValidationMetier,Converter=     {converters1:ErreurValidationMetierConverter},ConverterParameter=DateDerniereRevision}" 
    DisplayDate="{helpers:CultureAwareBinding DateClick}" String>
                    <Style TargetType="telerik1:RadCalendar" BasedOn="{StaticResource {x:Type telerik1:RadCalendar}}" >
                           <Setter Property="MonthViewHeaderFormat" Value="MMMM" />
                           <Setter Property="AreWeekNumbersVisible" Value="False"/>


Please help, is there anything in my code that doesn't let the TextBlock taking the format I need?

thank you

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 20 Mar 2019, 03:09 PM
Hello Siham,

Thank you for the attached image.

I would suggest you to take a look at the Defining a custom format section in the Formatting help article in our documentation. This section describes how you can apply custom format to the control. In your case will be: 
this.DatePickerRevision.Culture = new System.Globalization.CultureInfo("en-US");
this.DatePickerRevision.Culture.DateTimeFormat.ShortDatePattern = "dd/MMMM";

Give this approach a try and let me know if it works for you.

Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question