I have dd-MM-yyyy
date pattern for my windows machine. In below code I'm trying to get date format through C# code, but it's giving me M/d/yyy
instead of dd-MM-yyyy
. In code is correct ?
Console.WriteLine(DateTime.Now);
Console.WriteLine(CultureInfo.CurrentUICulture.DateTimeFormat.ShortDatePattern);