473,320 Members | 2,027 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

time elapsed in days hours minutes (unix to human readable form)

J M
I rebooted a network device just few minutes ago and getting device-up-time
value 3191. How do I convert a time elapsed in days hours minutes and
seconds for above value?

Example: This device has been up since 0 days 0 hours x minutes and x
seconds.

TIA!
Nov 16 '05 #1
2 3292
What units is that figure in? If its seconds you could use

double upTime = 3191;
TimeSpan ts TimeSpan.FromSeconds(upTime);
Console.WriteLine("This device has been up since {0} days {1} hours {2} minutes and {3} seconds", upTime.Days, upTime.Hours, upTime.Minutes, upTime.Seconds);

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

I rebooted a network device just few minutes ago and getting device-up-time
value 3191. How do I convert a time elapsed in days hours minutes and
seconds for above value?

Example: This device has been up since 0 days 0 hours x minutes and x
seconds.

TIA!
Nov 16 '05 #2
J M
Thanks for reply. Here is how I figure.

I rebooted device for about 5 to 7 minutes and the up time value was 3191 so
here is what I did to fix:

6 minutes = 300 seconds * 10 was close to above value:

TimeSpan ts = new TimeSpan( inputValue * 10 )

Above provided correct value.
"Richard Blewett [DevelopMentor]" <ri******@develop.com> wrote in message
news:eu*************@TK2MSFTNGP11.phx.gbl...
What units is that figure in? If its seconds you could use

double upTime = 3191;
TimeSpan ts TimeSpan.FromSeconds(upTime);
Console.WriteLine("This device has been up since {0} days {1} hours {2}
minutes and {3} seconds", upTime.Days, upTime.Hours, upTime.Minutes,
upTime.Seconds);

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

I rebooted a network device just few minutes ago and getting
device-up-time
value 3191. How do I convert a time elapsed in days hours minutes and
seconds for above value?

Example: This device has been up since 0 days 0 hours x minutes and x
seconds.

TIA!

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Michael Bulatovich | last post by:
I have a very simple db I use for keeping track of hours, tasks, projects, clients etc. It has a form that I use to enter data. Currently the form has a textbox for a field called "start time",...
2
by: Rene Ren | last post by:
I can using Environment.TickCount property to get the time elapsed since the system started. but this property using A 32-bit signed integer type, so it's can't count the time more than 24.9 days....
2
by: DWalker | last post by:
In Visual Studio (Visual Basic) .NET 2002, I noticed that this: Dim Elapsed as DateTime = Now - Now gives a "compile time" error (error in the IDE), saying that the '-' operator is not...
6
by: Harlin Seritt | last post by:
I would like to take milliseconds and convert it to a more human-readable format like: 4 days 20 hours 10 minutes 35 seconds Is there something in the time module that can do this? I havent...
2
by: Harlin Seritt | last post by:
How can I take a time given in milliseconds (I am doing this for an uptime script) and convert it to human-friendly time i.e. "4 days, 2 hours, 25 minutes, 10 seonds."? Is there a function from the...
6
by: JamesG | last post by:
I'm trying to convert a unix timestamp to a readable time, such as 4 hours ago, or 25 minutes ago. My code is below: function ago($ts) { /* time difference */ $ts = (time() - $ts); if($ts <...
2
by: dwasbig9 | last post by:
Hi Group (fairly limited knowledge of Access and almost none of Access VBA. Using Access 2003). I need to sum time, I've found through the groups archive an sql extract that led me to this ...
3
by: RN1 | last post by:
A Form has 2 TextBoxes where in users enter date & time. Example (in mm/dd/yyyy format): 09/20/2008 17:54 (1st TextBox) 09/29/2008 6:13 (2nd TextBox) How do I find out how much time (in...
15
by: student4lifer | last post by:
Hello, I have 2 time fields dynamically generated in format "m/d/y H:m". Could someone show me a good function to calculate the time interval difference in minutes? I played with strtotime() but...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.