By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,780 Members | 1,126 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,780 IT Pros & Developers. It's quick & easy.

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

P: 3
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
Share this Question
Share on Google+
3 Replies


kenobewan
Expert 2.5K+
P: 4,871
What problem are you having? Have you tried using an input and event with a calculation?
Jul 8 '07 #2

P: 3
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
Expert 2.5K+
P: 4,871
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

Post your reply

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