473,320 Members | 1,950 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.

Vb.net Newbie code for accumulating seconds and converting to Hours minutes seconds

Im trying to write code that would have seconds for the input,convert the seconds to the hours:minutes:seconds,accumulate the hours:minutes:seconds to a maximum of 999Hours:59Minutes:59Seconds as long as the user inputs more seconds.Then roller over to 0:0:0 and continue. Also need to be able to subtract from the accumulated value. Any help would be appreciated.
Jul 7 '07 #1
3 2914
kenobewan
4,871 Expert 4TB
What problem are you having? Have you tried using an input and event with a calculation?
Jul 8 '07 #2
What problem are you having? Have you tried using an input and event with a calculation?
Yes the code i have so far is:

input is "seconds"


'find the hours
hoursInteger = (hoursInteger + (seconds \ 3600)) Mod 1000
'find the minutes
minutesInteger = (minutesInteger + (secondsInteger + seconds) \ 60) Mod 60
'find the seconds
secondsInteger = (secondsInteger + seconds) Mod 60

when the time is at 0:59:59, and add 1 second I'm getting 0:0:0.
Also having trouble subtracting from the accumulated value.
Jul 8 '07 #3
kenobewan
4,871 Expert 4TB
It seems the hours are the problem, adding one second should give you zero minutes and seconds. Sometimes in these situations zero is first number used so that is not going to change until two hours, when one hour would be displayed. HTH.
Jul 9 '07 #4

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

Similar topics

6
by: Kription | last post by:
Hello, I am having a nightmare of a time getting seconds converted to hour-minute-seconds I have a third party application that outputs only in seconds since so if someone has been logged...
2
by: Dan Stromberg | last post by:
Is there already a pure python module that can do modular-arithmetic unit conversions, like converting a huge number of seconds into months, weeks... or a bandwidth measure into megabits/s or...
7
by: Stu | last post by:
Is there a simple function call within "C" that I can use to convert number of seconds (keep in mind this may be a type longlong and has to work on UNIX and NT) into Days, months, Hours, Minutes...
8
by: vunet.us | last post by:
How can I convert today's time (9:30:00) to seconds (34200) without using calculations like (9*3600)+(30*60)+0? Is there an easy function? Thank you
1
by: markdp | last post by:
I'm trying to write a program that takes a user inputted number of seconds and converts it into hours, minutes and seconds. So for instance, the program prompts the user for seconds, lets say 1000...
1
by: Bert Murphy | last post by:
I need help with code that would allow input in seconds (as many time as you would like) and would keep a running total of the output in the form of Hours:Minutes:Seconds as well as subtracting...
6
by: alexs | last post by:
hi, I'm moving a mysql database over to using db2 V9.5 The database is used by our radius server to store network accounting information from our switches. One parameter is the length of a...
3
by: =?Utf-8?B?U2hlbGRvbg==?= | last post by:
Hello - I have various times formatted like 00:00:00, so for example, 01:32:05 would be one thirty-two with five milliseconds. I need to convert this into seconds (an integer). First of...
10
by: mukeshrasm | last post by:
Hi the code written below is for calculating the number of days remain for a particular event based on the specific local time i.e. time in new york or time in london. <style style="text/css">...
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...
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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: 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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.