title: How to get the number of days in a year from a given date
body: <blockquote>
    <p>I need to calculate the day in a year from a given date, considering
    the year too.</p>
    
    <p>I'm in Brazil, so I'm using in the dd/mm/yyyy format</p>
  
  <pre><code>Console.WriteLine("Please inform the date in format dd/mm/yyyy");
  DateTime dateInformed = DateTime.Parse(Console.ReadLine());
  .
  .
  .
  Console.WriteLine("The day of the year is:" + );
  </code></pre>
    
    <p><strong>Examples</strong>:</p>
    
    <p>If I receive: 21/10/2016 I show the number of days in 2016</p>
    
    <p>If I receive: 21/10/1993 I show the number of days in 1993</p>
    
    <p>Considering if it's leap year or not.</p>
    
    <p><em>Sorry if I didn't explained well.</em></p>
    
    <p><em>Thanks!</em></p>
  </blockquote>
  
  <p>EDIT:
  Some people reported as duplicate question, but I don't think so.</p>
  
  <p>Let me try to explain in another way...</p>
  
  <p>I'm going to receive the complete date from the user in Console.
  I didn't figure out how to get the number of days in the year that the user gave to me in the format dd/mm/yyyy.
  I think the calc is basically: date that the user entered - first day of the year. But I also need to know if this year is leap year or not.
  But i don't know how to do this using DateTime in C#.</p>
  
  <p>Another example...</p>
  
  <p>25/10/<strong>2016</strong> - 01/01/2016 = day <strong>298</strong> of the year</p>
  
  <p>25/10/<strong>2015</strong> - 01/01/2015 = day <strong>297</strong> of the year</p>
  
  <p>I just have an idea receiving the day, month and year in different entrances.</p>
  
  <p>Thank you!</p>