I have a problem with a DateTimePicker control using a custom format that includes a two-letter version of AM / PM abbreviation.
Using "en-US" CultureInfo DateTimeFormat.ShortTimePattern results in "h: mm tt".
But setting this as a custom format in a DateTimePicker with the following code:
Dim curCul As CultureInfo = New CultureInfo("en-US") dtpTime.Format = DateTimePickerFormat.Custom dtpTime.CustomFormat = curCul.DateTimeFormat.ShortTimePattern
displays only hour and minutes. However, I also need an AM / PM part.
Examples:
11:04 AM is displayed as 11:04
2:00 PM is displayed as 2:00
Additional Note: I noticed that DateTimePicker is tracking the correct time. If I increase the time (I use ShowUpDown = true for this DateTimePicker control) and increase the time by 12 and save the changes to the database, AM / PM changes. Thus, it seems that βonlyβ is a problem for displaying the AM / PM part.
Thanks for any help. Franc
source share