|
-
Sep 30th, 2001, 10:31 PM
#1
Thread Starter
Fanatic Member
An Easy Question for you guys.....
Hey, I'm using VB and want to write code to convert seconds to min. and secs like this:
220 secs. to xx:xx
hope this makes sense
any help appreciated
-
Sep 30th, 2001, 11:42 PM
#2
Frenzied Member
Try Mod.
Using the Mod Operator is one possibility. The following suggests, but is not VB code.
40 = 220 Mod 60
(220 - 40 ) / 60 = 3
220 seconds = 3:40
Does the above give you a clue?
Live long & prosper.
The Dinosaur from prehistoric era prior to computers.
Eschew obfuscation!
If a billion people believe a foolish idea, it is still a foolish idea!
VB.net 2010 Express
64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.
-
Oct 1st, 2001, 12:53 AM
#3
Thread Starter
Fanatic Member
where did you get 40?
I understand some, but where did you get 40 in the first place?
-
Oct 1st, 2001, 03:25 AM
#4
Addicted Member
Dident make much sense to me ither, until i looked it over a few more times. i basicaly took his stuff and converted it to vb
Dim minutes, seconds As Integer
Const TimeInSeconds = 220
Private Sub Form_Load()
seconds = TimeInSeconds Mod 60
minutes = (TimeInSeconds - seconds) / 60
MsgBox (minutes & ":" & seconds)
End Sub
-
Oct 1st, 2001, 05:29 PM
#5
Frenzied Member
Hipopony66: The Mod Operator works on integer operands, and gives the remainder after dividing.
200 / 60 = 3, with a remainder of 40
Hence 40 = 220 Mod 60
Live long & prosper.
The Dinosaur from prehistoric era prior to computers.
Eschew obfuscation!
If a billion people believe a foolish idea, it is still a foolish idea!
VB.net 2010 Express
64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.
-
Oct 1st, 2001, 05:45 PM
#6
Addicted Member
You can use:
minutes = TimeInSeconds \ 60
instead of:
minutes = (TimeInSeconds - seconds) / 60
to find the no. of mins.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|