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

RadDateTimePicker Custom Format

7 Answers 544 Views
DateTimePicker
This is a migrated thread and some comments may be shown as answers.
Mark K.
Top achievements
Rank 1
Mark K. asked on 07 Oct 2009, 07:25 PM
Is there any way to make the "AM" and "PM" in the RadDateTimePicker be lower case without changing the computer's DateTime format?

7 Answers, 1 is accepted

Sort by
0
Martin Vasilev
Telerik team
answered on 13 Oct 2009, 06:06 AM
Hi Mark K.,

Thank you for the question.

You can customize the data format through the CustomFormat property. You also have to set the Format property to custom. Please, consider the following code:
this.radDateTimePicker1.Format = DateTimePickerFormat.Custom;
 
void radDateTimePicker1_ValueChanged(object sender, EventArgs e)
{
    if (this.radDateTimePicker1.Value.Hour > 11)
    {
        this.radDateTimePicker1.CustomFormat = "\"pm\" hh.mm";
    }
    else
    {
        this.radDateTimePicker1.CustomFormat = "\"am\" hh.mm";
    }
}

Do not hesitate to contact me again if you have other questions.

Greetings,
Martin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Mark K.
Top achievements
Rank 1
answered on 27 Oct 2009, 10:10 PM
The code you wrote puts the "am" and "pm" in front of the number, which I've never seen before.  Is that a European thing?  I fixed that, but the real problem is that when you edit the time in the box while the application is running there doesn't seem to be any way to edit the "am" and "pm" to change it to the other.

If I click on the arrow key to increment the numbers, it never goes from am to pm.

The whole edit routine of the time picker leaves much to be desired.  Why does it drop off leading zeros and go to single digits when you put your cursor on one of the numbers?

0
Boyko Markov
Telerik team
answered on 28 Oct 2009, 07:49 AM
Hello Mark K.,

You should do the following to specify a time format which includes the "AM", "PM" time part:

this.radDateTimePicker1.Format = DateTimePickerFormat.Custom;
            this.radDateTimePicker1.CustomFormat = "hh:mm:tt";

I hope this helps.

Regards,
Boyko Markov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Mark K.
Top achievements
Rank 1
answered on 28 Oct 2009, 04:16 PM
I already have that.  You didn't read the first post.  I was asking how to make the "am" and "pm" be lower case.
0
Accepted
Boyko Markov
Telerik team
answered on 29 Oct 2009, 08:28 AM
Hello Mark K.,

You do not have to change the date time format of your computer. You should just change a few settings of RadDateteTimePicker date time format.

You can do the following:

this.radDateTimePicker1.Culture = new CultureInfo("en-US");                  this.radDateTimePicker1.Culture.DateTimeFormat.AMDesignator = "am";
this.radDateTimePicker1.Culture.DateTimeFormat.PMDesignator = "pm";

You can use any string at the place of "AMDesignator" and "PMDesignator". If you have more questions, please contact us again.

Regards,
Boyko Markov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Mark K.
Top achievements
Rank 1
answered on 29 Oct 2009, 07:14 PM
Thanks.  That's what I needed.
0
Boyko Markov
Telerik team
answered on 30 Oct 2009, 07:22 AM
Hi Mark K.,

I am happy that this helps. I hope that everything is going well with your application. If you have additional questions, please do not hesitate to contact us.

All the best,
Boyko Markov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
DateTimePicker
Asked by
Mark K.
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Mark K.
Top achievements
Rank 1
Boyko Markov
Telerik team
Share this question
or