title: System.InvalidCastException: 'Unable to cast object of type 'System.TimeSpan' to type 'System.IConvertible'
body: <p>I am new to .Net. I am trying to calculate age. However getting below error.</p>
  
  <p>System.InvalidCastException: 'Unable to cast object of type 'System.TimeSpan' to type 'System.IConvertible'</p>
  
  <p>Below is code snippet.</p>
  
  <pre><code>static void Main()
      {
          var dateAndTime = DateTime.Now;
          DateTime dateOfBirth = new DateTime(1995, 04, 17);
          var date = dateAndTime.Date;
          int age = Convert.ToInt32(date - dateOfBirth);
          Console.WriteLine("Your age is " + age);
      }
  </code></pre>