title: Getting last reboot time
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1600962/displaying-the-build-date">Displaying the build date</a><br>
    <a href="https://stackoverflow.com/questions/7407286/how-to-know-when-was-windows-started-or-shutdown">How to know when was Windows started or shutdown?</a>  </p>
  </blockquote>
  
  
  
  <p>for my purposes I am writing a C# executable that will calculate the difference in time (minutes) from the time right now and the time the server was last rebooted.</p>
  
  <p>What I am currently doing now is capturing and parsing the output from cmd -> "net stats server" and creating a new <code>DateTime</code> object then comparing that with <code>DateTime.Now</code> with a <code>TimeSpan</code> object.</p>
  
  <p>Is there a cleaner way to do this <strong>without the use of 3rd party downloads</strong>? I am scared that not all date formats from "net stats server" are in the format that I will expect.</p>
  
  <p>**edit my bad, this is a duplicate, but for what it is worth my solution was using this:</p>
  
  <pre><code>float ticks = System.Environment.TickCount;
  Console.WriteLine("Time Difference (minutes): " + ticks / 1000 / 60);
  Console.WriteLine("Time Difference (hours): " + ticks / 1000 / 60 / 60);
  Console.WriteLine("Time Difference (days): " + ticks / 1000 / 60 / 60 / 24);
  </code></pre>