This is quite nonsense:
if (c == 2) && (c == 3)
would never be true: a variable cannot have two values at the same time.
if (c == 2) && (d == 3)
would never be true either: both variables are declared at the same time and incremented at the same time. Unless you did not show all of the code, there is no chance one can have a value which differs from the other.
Moreover, none of this is related to DateTime display-format.
Here's the skeleton to retrieve and modify a datetime's format:
string value = "01.01.2019 00:00:00";
DateTime dt;
string formattedDate;
if (DateTime.TryParseExact(
value,
"dd.MM.yyyy HH:mm:ss",
CultureInfo.CurrentCulture,
DateTimeStyles.None,
out dt
) {
formattedDate = dt.ToString("dd.MM.yyyy");
}
else
{
}