[Solved] Converting convert the datetime in dd/MMM/yyyy to string in dd/MM/yyyy format C# [closed]


Just use DateTime.ToString(string) method like;

datetime.ToString(@"dd\/MM\/yyyy");

Remember, "https://stackoverflow.com/" format specifier has a special meaning in custom date and time formatting as replace me current culture’s or specified culture date separator. If your CurrentCulture‘s DateSeparator is already /, you can use it without escaping like;

datetime.ToString("dd/MM/yyyy");

or you can provide IFormatProvider which has / as a DateSeparator as a second parameter to your .ToString() method (ex: InvariantCulture ) like;

datetime.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture);

0

solved Converting convert the datetime in dd/MMM/yyyy to string in dd/MM/yyyy format C# [closed]