I'm having a problem with a DateTimePicker control using a custom format which includes the the two-letter A.M./P.M. abbreviation.
Using an 'en-US' CultureInfo DateTimeFormat.ShortTimePattern results in'h:mm tt'.
But setting this as custom format in a DateTimePicker with the following code:
results in only the hour and the minutes being displayed.I however also need the AM/PM part.
Dec 20, 2010 hi i used Asp.Net Datetime control but when we click on that then the page was postback i dont like this, so i used BasicFrame.WebControls.BasicDatePicker.dll after that i. Tags: DateTime picker control, DateTimePicker, VB.net, windows control A DateTimePicker control allows users to select a date and time in Windows Forms applications. In this tutorial, we will see how to create a DateTimePicker control at design-time as well as.
Examples:
11:04 AM is displayed as 11:04
2:00 PM is displayed as 2:00
Additional remark:I noticed that the DateTimePicker keeps track of the correct time.If I increase the time (I'm using ShowUpDown = true for this DateTimePicker control) and increase the hour by 12 and save the changes into the database, the AM/PM has changed.So it seems 'only' to be an issue about displaying the AM/PM part.
Thanks for any help.Frank
FrankEFrankE
15311 gold badge22 silver badges1414 bronze badges
4 Answers
Sudhakar BSudhakar B
I have the same issue. This for the 'Why' :Actually according to MS : https://support2.microsoft.com/Default.aspx?scid=kb%3ben-us%3b889834&x=18&y=19Date picker don't use the current thread culture : it uses the user regional settings.SO if you force the date picker custom format something containing 'tt', and if the user regional setting doesnt have any designator ... well it won't be shown.
MadguiMadgui
David Gorsline
4,5741010 gold badges2626 silver badges3434 bronze badges
![]()
ariel imperioariel imperio
Make sure that in Windows settings you also have set time format properly to display AM/PM. Time format in Windows should be also set to H:mm tt to display your result properly.
kirill dorofeyevkirill dorofeyev
Not the answer you're looking for? Browse other questions tagged vb.netwinformsdatetimepickerdatetime-format or ask your own question.Comments are closed.
|
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |