title: Simple Age Calculator base on date of birth in C#
body: <p>I have created a simple age calculator. I want to remove decimal places but the problem is when I substract <code>now</code> to <code>bday</code>.   </p>
  
  <p><strong>example</strong> : I input <code>2012</code>, <code>10</code> and <code>23</code> and the date now is <code>2014-10-22</code>,
  So when <code>2014.1022 - 2012.1023</code> the result would be <code>1.9999...</code> I want to remove all decimal places and remain the whole number <code>1</code>, but the time I use <code>String.Format("{0:00}"</code> It rounds off the result to <code>02</code>even when I use <code>ConvertToInt32</code>, I don't want to use <a href="http://www.dotnetperls.com/split">split string</a> it needs a lot of code.</p>
  
  <p>Any Ideas?</p>
  
  <pre><code> static void Main(string[] args)
          {
              string year, month, day = string.Empty;
              Console.WriteLine("Enter your Birthdate:");
              Console.WriteLine("Year :");
              year = Console.ReadLine();
              Console.WriteLine("Month :");
               month = Console.ReadLine();
              Console.WriteLine("Day :" );
              day = Console.ReadLine();
              try
              {
                  DateTime date = Convert.ToDateTime(year + "-" + month + "-" + day);
                   var bday = float.Parse(date.ToString("yyyy.MMdd"));
                   var now = float.Parse(DateTime.Now.ToString("yyyy.MMdd"));
                   if (now &lt; bday)
                   {
                       Console.WriteLine("Invalid Input of date");
                       Console.ReadLine();
  
                   }
                   Console.WriteLine("Your Age is " + (String.Format("{0:00}", (now - bday)))); //it rounds off my float
                   Console.ReadLine();
              }
              catch (Exception ex)
              {
                  Console.WriteLine(ex.ToString());
                  Console.ReadLine();
              }
  
          }
  </code></pre>
  
  <p>}</p>