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

DateTimePicker: Select Month and Day without Year

10 Answers 3339 Views
DateTimePicker
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 02 Jan 2012, 06:27 PM
I'm building a rules engine that allows date constraints.  I want to be able to use a datetime picker to select the month and day, but I don't want to show the year.  Is this possible with your control?

Jason

10 Answers, 1 is accepted

Sort by
0
Dani
Telerik team
answered on 03 Jan 2012, 01:38 PM
Hi Jason,

I think what you need is simply custom formatting for the display date. Please, check the Formatting help article on RadDateTimePicker. I hope it helps. 


Greetings,
Dani
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Jason
Top achievements
Rank 1
answered on 03 Jan 2012, 04:03 PM
Thanks Dani.

I am currently doing that, but I need the year not to show at the top of the calendar when the picker is clicked.  Attached is a picture of what I mean.
0
Accepted
Dani
Telerik team
answered on 04 Jan 2012, 09:34 AM
Hello Jason,

You can then use the MonthViewHeaderFormat and assign it via the CalendarStyle property of RadDateTimePicker:

<Style x:Key="CalendarStyle" TargetType="telerik:RadCalendar">
    <Setter Property="MonthViewHeaderFormat" Value="MMMM" />            
</Style>

I hope this will help solve the issue.

Regards,
Dani
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Siham
Top achievements
Rank 1
answered on 12 Mar 2019, 04:16 PM

Hello, Don't know if Jason has his problem solved, but I am in the same case, need to not show the Year on my DatePicker (only month and day).

 

I've tried the solution above but it doesn't work.

Thanks for your help

0
Martin Ivanov
Telerik team
answered on 14 Mar 2019, 07:49 AM
Hello Jason,

I've tested the Daniela's solution and its works like a charm. Only the month is shown. However, if you want to show also the day you will need to use a bit different format. For example "MMMM - ddd" or "MMMM - d". I've attached a small example showing this approach. I hope it helps.

Regards,
Martin Ivanov
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.
0
Siham
Top achievements
Rank 1
answered on 14 Mar 2019, 08:19 AM

Hello, thanks for answering.

It effectively works but only on a RadCalendar, but as I need to use a RadDatePicker, this does'nt give any possibility to use the property.

Thank you for your help. As I am a biginner I maybe need more assistance :)

0
Martin Ivanov
Telerik team
answered on 14 Mar 2019, 09:13 AM
Hello Siham,

It seems that I am missing something here. Yes, the property is defined on the RadCalendar control which is used both in RadDateTimePicker and RadDatePicker. Both controls have the CalendarStyle property which you can use to set the MonthViewHeaderFormat property of the calendar. I've only changed the type of the control in my project from RadDateTimePicker to RadDatePicker and the format still works.
<telerik:RadDatePicker VerticalAlignment="Center" HorizontalAlignment="Center">
    <telerik:RadDateTimePicker.CalendarStyle>
        <Style TargetType="telerik:RadCalendar">
            <Setter Property="MonthViewHeaderFormat" Value="MMMM - d" />
        </Style>
    </telerik:RadDateTimePicker.CalendarStyle>
</telerik:RadDatePicker>
Can you please tell me what am I missing? Also, can you send me a picture of the expected result?

As a small note on the CalendarStyle property, keep in mind that the RadDatePicker control hosts a RadCalendar (shown when the popup opens). The CalendarStyle property allows you to define a Style that will be passed to the RadCalendar control when the popup opens.

Regards,
Martin Ivanov
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.
0
Siham
Top achievements
Rank 1
answered on 14 Mar 2019, 10:38 AM

Hello, It works now, thank you

The difference was on the calendarstyle part, I was using RadDatePicker instead of RadDateTimePicker, now it works :)

 

0
Jason
Top achievements
Rank 1
answered on 14 Mar 2019, 12:32 PM
Thanks guys.  I don't remember asking the question (it was 7 years ago), but since I marked Dani's answer as the "Answer" I guess it was correct.  The solution looks reasonable.
0
Moses
Top achievements
Rank 1
answered on 26 Dec 2019, 08:01 AM

Hello Siham, 

If you can share your control's screenshot after removing the year, it would be of great help..

Just want to confirm whether this is what exactly our customers need.

Thanks.

Tags
DateTimePicker
Asked by
Jason
Top achievements
Rank 1
Answers by
Dani
Telerik team
Jason
Top achievements
Rank 1
Siham
Top achievements
Rank 1
Martin Ivanov
Telerik team
Moses
Top achievements
Rank 1
Share this question
or