none
Custom date *and* time RRS feed

  • Question

  • I'm trying to format a DateTime to work in multiple cultures.  I want the date *AND* time in one ToString() call.  The date should be of the form <day> <month abbreviation year> and the time in 12-hour AM/PM for en-US and 24-hour without AM/PM for other cultures.  E.g.: for October 13, 2016 at 7:09 PM, I want:

    "13 oct 2013 7:09 PM" for en-US

    "13 Okt 2013 19:09" for de-DE

    I tried "d MMM yyyy T", which yields "13 Okt 2016 T".  If I use just "T", the time is correct, with AM/PM for en-US and 24-hour time for other cultures.

    Is there any way to combine the custom "d MMM yyyy" and "T" in one format string?

    Thursday, October 13, 2016 3:01 PM

Answers