Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8259331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:50:07+00:00 2026-06-08T02:50:07+00:00

Possible Duplicate: Displaying the build date How to know when was Windows started or

  • 0

Possible Duplicate:
Displaying the build date
How to know when was Windows started or shutdown?

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.

What I am currently doing now is capturing and parsing the output from cmd -> “net stats server” and creating a new DateTime object then comparing that with DateTime.Now with a TimeSpan object.

Is there a cleaner way to do this without the use of 3rd party downloads? I am scared that not all date formats from “net stats server” are in the format that I will expect.

**edit my bad, this is a duplicate, but for what it is worth my solution was using this:

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);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T02:50:08+00:00Added an answer on June 8, 2026 at 2:50 am

    this answer should help you. If you want to know when the system was last rebooted just take the uptime value and subtract it from the current date/time

    code from linked answer

    public TimeSpan UpTime {
        get {
            using (var uptime = new PerformanceCounter("System", "System Up Time")) {
                uptime.NextValue();       //Call this an extra time before reading its value
                return TimeSpan.FromSeconds(uptime.NextValue());
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: InfoWindow not Displaying Still lingering on a problem that I do not
Possible Duplicate: Running a command from Ruby displaying and capturing the output I have
Possible Duplicate: Objective C for Windows iPhone development on Windows Is there any way
Possible Duplicate: Format Date in Bind Statement inside a ListView I have modified a
Possible Duplicate: C/C++ Image Loading I need a C\C++ cross-platform library for loading/displaying images(jpg,gif,png,tga).
Possible Duplicate: Displaying the #include hierarchy for a C++ file in Visual Studio I
Possible Duplicate: Sorted ArrayList not displaying? Code: String title1 = Original Order\n\n; String title2
Possible Duplicate: jquery - disable anchor jump when loading a page I'm displaying a
Possible Duplicate: Javascript date sorting by convert the string in to date format I
Possible Duplicate: Displaying Calendar in an Android App Hi i want to show a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.