I\'m to get a custom DateTime format including the AM/PM designator, but I want the \"AM\" or \"PM\" to be lowercase without making the rest of of the characters lo
EDIT: Jon's example is much better, though I think the extension method is still the way to go so you don't have to repeat the code everywhere. I've removed the replace and substituted Jon's first example in place in the extension method. My apps are typically intranet apps and I don't have to worry about non-US cultures.
Add an extension method to do this for you.
public static class DateTimeExtensions
{
public static string MyDateFormat( this DateTime dateTime )
{
return dateTime.ToString("ffffdd, MMMM d, yyyy a\\t h:mm") +
dateTime.ToString("tt").ToLower();
}
}
...
item.PostedOn.MyDateFormat();
EDIT: Other ideas on how to do this at How to format a DateTime like "Oct. 10, 2008 10:43am CST" in C#.