-1
TimeSpan result = DateTime.Today.Subtract(birthDaydateTimePicker.Value);
resultTextBox.Text = result.ToString();

I want the result to show as dd/mm/yyyy format.

Falko
  • 17,076
  • 13
  • 60
  • 105
Hussein A.
  • 1
  • 1
  • 2

1 Answers1

1

This should work, your subtracting dates looks fine assuming your parameter is a date value

{
     TimeSpan result = DateTime.Today.Subtract(birthDaydateTimePicker.Value);
     resultTextBox.Text =  result.ToString("dd/MM/yyyy");
}

Subtracting dates

Changing the format of a date

Community
  • 1
  • 1
Huang Chen
  • 1,177
  • 9
  • 24