Reputation: 891
I am using following code to format my datum
ToString("MMMM dd, hh:mmtt", System.Globalization.CultureInfo.CreateSpecificCulture("en-UK")
It results in i.e. June 01, 8:34PM. I need only "PM" ("AM") be lowercase "pm" ("am"). What is the simplest method to achieve it?
Thanks!
Upvotes: 0
Views: 5027
Reputation: 9224
I think you're going to have to split the strings and join them together.
Also, you don't need to specify the culture if you're doing custom formatting. The culture is really for the standard formats.
So I would do something like the following
var curDate = DateTime.Now;
var dateString = curDate.ToString("MMMM dd, hh:mm") + curDate.ToString("tt").ToLower();
Upvotes: 3