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

Non-Military Time Format

5 Answers 146 Views
TimePicker
This is a migrated thread and some comments may be shown as answers.
mark connell
Top achievements
Rank 1
mark connell asked on 02 Dec 2008, 07:02 PM
Hi, is there any way to use a AM/PM format for the time picker?  The current military format isn't the most desirable option for our application.

Thanks in advance!

5 Answers, 1 is accepted

Sort by
0
Bobi
Telerik team
answered on 04 Dec 2008, 02:34 PM
Hi mark connell,

The most recent version of RadTimePicker displays time in format that depends on CultureInfo.CurrentCulture. So to display time in AM/PM format you will need to set CurrentCulture to a format that has AM/PM. For the future versions of the control we have plans to support multiple time formats without dependency on CurrentCulture.

Regards,
Boryana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
mark connell
Top achievements
Rank 1
answered on 09 Dec 2008, 10:35 PM
Thanks for the reply.  However, I am getting an error when I select a culture in Expression Blend 2.  Here is the XAML that is generated when I select English (United States) from the list of available culture options:

        <telerikInput:RadTimePicker HorizontalAlignment="Left" Margin="8,0,0,27" x:Name="PickerStartTime1" VerticalAlignment="Bottom" Width="Auto" Grid.Column="1" SelectedTime="06:00:00" StartTime="00:00:00" TimeInterval="00:30:00" d:LayoutOverrides="HorizontalAlignment, Height">
         <telerikInput:RadTimePicker.Culture>
          <System_Globalization:CultureInfo>
           <System_Globalization:CultureInfo.NumberFormat>
            <System_Globalization:NumberFormatInfo CurrencyDecimalDigits="2" CurrencyDecimalSeparator="." CurrencyGroupSeparator="," CurrencyNegativePattern="0" CurrencyPositivePattern="0" CurrencySymbol="$" DigitSubstitution="None" NaNSymbol="NaN" NegativeInfinitySymbol="-Infinity" NegativeSign="-" NumberDecimalDigits="2" NumberDecimalSeparator="." NumberGroupSeparator="," NumberNegativePattern="1" PerMilleSymbol="‰" PercentDecimalDigits="2" PercentDecimalSeparator="." PercentGroupSeparator="," PercentNegativePattern="0" PercentPositivePattern="0" PercentSymbol="%" PositiveInfinitySymbol="Infinity" PositiveSign="+"/>
           </System_Globalization:CultureInfo.NumberFormat>
           <System_Globalization:CultureInfo.DateTimeFormat>
            <System_Globalization:DateTimeFormatInfo AMDesignator="AM" CalendarWeekRule="FirstDay" DateSeparator="/" FirstDayOfWeek="Sunday" FullDateTimePattern="dddd, MMMM dd, yyyy h:mm:ss tt" LongDatePattern="dddd, MMMM dd, yyyy" LongTimePattern="h:mm:ss tt" MonthDayPattern="MMMM dd" PMDesignator="PM" ShortDatePattern="M/d/yyyy" ShortTimePattern="h:mm tt" TimeSeparator=":" YearMonthPattern="MMMM, yyyy">
             <System_Globalization:DateTimeFormatInfo.Calendar>
              <System_Globalization:GregorianCalendar CalendarType="Localized" TwoDigitYearMax="2029"/>
             </System_Globalization:DateTimeFormatInfo.Calendar>
            </System_Globalization:DateTimeFormatInfo>
           </System_Globalization:CultureInfo.DateTimeFormat>
          </System_Globalization:CultureInfo>
         </telerikInput:RadTimePicker.Culture>
        </telerikInput:RadTimePicker>

The Description of the Error is: Cannot create an instance of "CultureInfo".

Any ideas?  Thanks again in advance!
0
Hristo
Telerik team
answered on 15 Dec 2008, 08:22 AM
Hi Mark,

Silverlight parser doesn't support creation of NumberFormatInfo in XAML. The only way that you could set it is from the code. We can only hope that this will be fixed in the next Silverlight version.

Sorry for the troubles.


Kind regards,
Hristo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Allan Zhou
Top achievements
Rank 1
answered on 07 Jul 2009, 05:27 AM
Hi,

I'm still have the same problem to show the time with AM/PM. I set the Culture to "en-US", and it shows correctly when the page shows up(like 6:00AM, 6:00PM). My problem is, I have to reset the selectedTime to be a computed value, I do like this:

this.timePicker.SelectedTime = new TimeSpan(22,0,0);

Then it shows without AM/PM, how do I let them show AM/PM after setting the values?

Thanks.

Allan
0
Kaloyan
Telerik team
answered on 09 Jul 2009, 08:42 AM
Hello Allan Zhou,

Thank you for reporting the issue. The problem you are facing is due to the fact that you have a very old version of the RadControls for Silverlight. I suggest you try to download the latest official Q2 2009 release and give it a go.

Let us know how this goes.

Best wishes,
Kaloyan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
TimePicker
Asked by
mark connell
Top achievements
Rank 1
Answers by
Bobi
Telerik team
mark connell
Top achievements
Rank 1
Hristo
Telerik team
Allan Zhou
Top achievements
Rank 1
Kaloyan
Telerik team
Share this question
or