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

RadDatePicker - Need to Format Date

5 Answers 471 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
Top Gun
Top achievements
Rank 1
Top Gun asked on 08 Jun 2011, 08:47 PM

When the user selects a date in the RadDatePicker, I need the date to be displayed as dd/MM/yyyy.  How can I get this format, dd/MM/yyyy, to be displayed in the control?

my xaml

<telerik:RadDatePicker Name="myDatePicker" InputMode="DatePicker" Height="30" HorizontalAlignment="Stretch" />

5 Answers, 1 is accepted

Sort by
0
Accepted
Dani
Telerik team
answered on 09 Jun 2011, 08:24 AM
Hello Amrit,

Please, check this online help article on the topic of formatting in the RadDateTimePicker control(RadDateTimePicker with InputMode="DatePicker" is the same as RadDatePicker). It describes how you can specify custom formatting. I hope it helps.

Greetings,
Dani
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
0
Top Gun
Top achievements
Rank 1
answered on 09 Jun 2011, 03:38 PM
Thanks.  I appreciate the help.
0
David
Top achievements
Rank 1
answered on 20 Nov 2012, 05:33 AM
Hi,

I don't use code-behind (we use MVVM) - how can I do this in XAML?

Thanks
0
Boyan
Telerik team
answered on 22 Nov 2012, 03:29 PM
Hi Rodney,

Currently there is no way to set the format in XAML. You can only set this as shown in the link below. In MVVM scenario you can try to achieve this by binding the Culture property of the DateTimePicker to your ViewModel. As this is not very convenient we have logged this in our PITS, you can follow the items progress and vote for it here.

Regards,
Boyan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
David
Top achievements
Rank 1
answered on 25 Feb 2013, 04:12 AM
Thanks, I went this route:

public CultureInfo CultureWithFormattedPeriod
{
    //Hack to get around the fact that there is no custom date format in the Telerik DatePicker
    get
    {
        var tempCultureInfo = (CultureInfo)CultureInfo.CurrentCulture.Clone();
        tempCultureInfo.DateTimeFormat.ShortDatePattern = "MMyyyy";
 
        return tempCultureInfo;
    }
}

and in my View:
<telerik:RadDateTimePicker
    Culture="{Binding Path=CultureWithFormattedPeriod}"
    InputMode="DatePicker"
    DateSelectionMode="Month"
    SelectedValue="{Binding Path=ExtendedEditor.From, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True}" />
Tags
DatePicker
Asked by
Top Gun
Top achievements
Rank 1
Answers by
Dani
Telerik team
Top Gun
Top achievements
Rank 1
David
Top achievements
Rank 1
Boyan
Telerik team
Share this question
or