I'm trying to convert a Date, into a Romanian DateTime String. This is my code:
using System.Globalization;
var date = DateTime.Now;
var cult = CultureInfo.GetCultureInfo("ro-RO");
var dateToString = date.ToString(cult.DateTimeFormat.ShortDatePattern);
var result = ($"input: {date.ToString()} - formatted: {dateToString} - format:{cult.DateTimeFormat.ShortDatePattern}");
Console.WriteLine(result);
The date today is 11/10/2022 (October 11th).
The problem is that I'm expecting the dateToString
variable to have a value of "11.10.2022" but I'm getting a "10.11.2022" (in otherwords my dd.MM.yyyy format translates to a MM.dd.yyyy)
What can I do to get the correct string representation of my date?
Thanks a lot in advance!