How to get a Long Date format from DateTime without a weekday

Adam Tegen picture Adam Tegen · Sep 8, 2009 · Viewed 22.1k times · Source

I'm looking for a locale-aware way of acquiring a long date time without the weekday. Just such a beast exist?

Below is the code I use to get the long date format including the weekday:

DateTime time = ...
String formattedDate = time.ToLongDateString();

Edit

Examples of what I would like to see:

  • en-us: December 5, 2009
  • fr-fr: 5 décembre 2009
  • es-es: 05 de diciembre de 2009

ToLongDateString() returns the following:

  • en-us: Saturday, December 5, 2009
  • fr-fr: samedi 5 décembre 2009
  • es-es: sábado, 05 de diciembre de 2009

Answer

Moslem Hady picture Moslem Hady · May 31, 2013
String formattedDate = DateTime.Now.Date.ToLongDateString().Replace(DateTime.Now.DayOfWeek.ToString()+ ", ", "")