Reputation: 2145
Everywhere in my code, when dealing with dates, I rely on the DateTime Format String "G". EXCEPT in the DateTimePicker itself, as I must set a CustomFormat, and the CustomFormat doesn't accept "G" as a valid format specifier. I need this so that the dates will all look the same, independent of culture.
Any thoughts on how I might circumvent this issue?
Upvotes: 0
Views: 212
Reputation: 8402
The following code should work:
picker.CustomFormat = DateTimeFormatInfo.ShortDatePattern + DateTimeFormatInfo.LongTimePattern
This is essentially what the "G" format specifier gives you.
Upvotes: 1