string month = DateTime.Today.Month.ToString();
if (DateTime.Today.Month < 10)
{
month = "0" + month;
}
string day = DateTime.Today.Day.ToString();
if (DateTime.Today.Day < 10)
{
day = "0" + day;
}
string dateCorrect = String.Format("{0}.{1}.{2}", DateTime.Today.Year, month, day);
string dateDue = "";
if (transferFields.DueDate.SelectedDate.HasValue)
{
var dateDuearr = transferFields.DueDate.Value.Split(' ')[0].Split('.');
dateDue = dateDuearr[2] + '.' + dateDuearr[1] + '.' + dateDuearr[0];
}
else {
dateDue = dateCorrect;
}
Real developers don't use built in parsing and formatting methods.