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

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

Falko
  • 16,102
  • 13
  • 53
  • 98
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,149
  • 9
  • 24