Format for Date - Incorrect Format for Spanish

  • Thread starter Thread starter Kent-15
  • Start date Start date
K

Kent-15

Guest
Hi guys,

I was trying to cast some date into an specific format in Spanish. The initial string I'm using is as an example: "01/31/2019"

So, what I expect from the casting is: "31-Ene-2019", but I'm receiving the following "31-ene.-2019" (month without initial Capital letter and a dot symbol).

Here the sample code I created:

public void ObtainDate()
{
DateTime dateConverted = DateTime.Parse("01/31/2019");

Console.WriteLine(dateConverted.ToString("dd-MMM-yyyy", CultureInfo.CreateSpecificCulture("es-ES")));
}

Please can anybody give me a hand on this?

Thanks a lot,

Continue reading...
 
Back
Top