473,324 Members | 2,417 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,324 software developers and data experts.

How to convert seconds to HH:MM:SS

Write a C# program that prompts the user to input the elapsed time for an event in seconds. The program then outputs the elapsed time in hours, minutes, and seconds. (for example, if the elapsed time is 9630 seconds, then the output is 2:40:30.)

Can anyone pls help me!!
Im using visual studio 2005
Nov 5 '07 #1
8 12129
kenobewan
4,871 Expert 4TB
Here is a search that may help:
c# How to convert seconds to HH:MM:SS
Nov 5 '07 #2
balabaster
797 Expert 512MB
Here is a search that may help:
c# How to convert seconds to HH:MM:SS
Minutes = (Seconds \ 60) '(This will convert your seconds to whole minutes)
Hours = (Minutes \ 60) '(This will convert your minutes to whole hours
Days = (Hours \ 24)
Weeks = (Days \ 7)
Months gets tricky because none of them are the same length
Seconds = Seconds Mod 60 '(This will give you the remaining seconds)
You should be able to figure out the rest from there...use mod to get remaining parts like I demonstrated with the seconds.
So: (Hours Mod Minutes) will get you the remaining minutes outside the hour etc etc...
Nov 5 '07 #3
Motoma
3,237 Expert 2GB
So: (Hours Mod Minutes) will get you the remaining minutes outside the hour etc etc...
I think you mean hours mod 60.
Nov 5 '07 #4
balabaster
797 Expert 512MB
I think you mean hours mod 60.
That'll teach me to answer questions as I'm rushing out the door...hehe.

Sorry, I meant minutes mod 60...houirs mod 60 wouldn't give you much of interest as there's 24 hours in a day, not 60 hours in a day ;)
Nov 5 '07 #5
Motoma
3,237 Expert 2GB
That'll teach me to answer questions as I'm rushing out the door...hehe.

Sorry, I meant minutes mod 60...houirs mod 60 wouldn't give you much of interest as there's 24 hours in a day, not 60 hours in a day ;)
Haha, that will teach me to respond snidely while rushing :D
Cheers!

Motoma
Nov 5 '07 #6
Plater
7,872 Expert 4TB
I think you all ment to say:

Sorry, we don't do school projects here. Try working it out yourself and if you have any specific questions regarding code, please feel free to ask those.
Nov 5 '07 #7
balabaster
797 Expert 512MB
I think you all ment to say:

Sorry, we don't do school projects here. Try working it out yourself and if you have any specific questions regarding code, please feel free to ask those.
Yes that's exactly what we meant...I guess sometimes it just takes a different pair of eyes :oP
Nov 5 '07 #8
yes i will help u man meettapan.
but i m use Turbo c++
Dec 16 '14 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: hikums | last post by:
Does anyone have a function to convert duration in seconds to a format hh:mm:ss Thanks.
2
by: D. Shane Fowlkes | last post by:
Here's a good one. I've been using an Excel spreadsheet for the past couple of years to calculate a file's Estimated Download Time based off of a solid 50kbs connection (dial up). This is for a...
6
by: Able | last post by:
Dear friends I need to format seconds as hh:mm:ss. I see a lot of coding transforming seconds to hh:mm:ss. Somebody know a short way? Regards Able
2
by: Robert Brown | last post by:
Hi all. I have written a program that transfers data via FTP. I can calculate the rough amount of time left. I get a value such as 70.83 seconds left for instance. What I want to do is to...
14
by: Michael Barrido | last post by:
I have this for example: Dim iSeconds as int32 = 3600 '3600 seconds is one hour How do i convert it to "01:00:00" ? Please help. Thanks in advance!
5
nirmalsingh
by: nirmalsingh | last post by:
i am getting date format in string as 30-11-2006 05:59:44 PM . i want to convert in the format of yyyy-mm-dd hh:mm:ss to sore it in mysql database. Help me with sample coding plz..
1
seshu
by: seshu | last post by:
Hi every body to morning my cousine has show his application and also his live db in that to sav the length of all the voice files he has saved in time format ie he took the datatype of time now i...
1
seshu
by: seshu | last post by:
Hi every body to morning my cousine has show his application and also his live db in that to sav the length of all the voice files he has saved in time format ie he took the datatype of time now i...
1
by: emajka21 | last post by:
I am using Visual Studios 2005 with C#. I have a time field that is stored in seconds. I want to display it as hours:minutes:seconds in a repeater field. I know I can use division and mod's to get...
5
by: sudip77 | last post by:
Hi, I have an user input variable called @stop_time which takes input in the format of HH:MM:SS. I need to convert it into seconds only. How can I do that? Can anyone help please?
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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)...
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
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.