-
May 27th, 2020, 04:38 PM
#1
Thread Starter
Member
convert minutes to seconds
Code:
Debug.Print Val("62") \ 60 & ":" & Val("12") Mod 60
this converts seconds to minutes
-
May 27th, 2020, 09:27 PM
#2
Re: convert minutes to seconds
What?????????????????????
Try this instead....it will give the CORRECT answer, unlike whatever you posted!!!!
Code:
Dim iSeconds As Integer
iSeconds = 62
Debug.Print iSeconds \ 60 & ":" & Format(iSeconds Mod 60, "00")
Last edited by SamOscarBrown; May 27th, 2020 at 09:32 PM.
Sam I am (as well as Confused at times).
-
May 28th, 2020, 12:42 AM
#3
Re: convert minutes to seconds
If you want to convert minutes to seconds as your thread title says then you multiply by 60
Seems like you are actually wanting to convert seconds to minutes and seconds instead which of course is quite different but given the brief and vague nature of the post I can only guess at what you really want.
-
May 28th, 2020, 04:54 AM
#4
Re: convert minutes to seconds
If it's seconds (converted to minutes), then there's the quite convenient, builtin:
- TimeSerial(...) function ...which simply "adds up all passed parameters, with their appropriate multipliers"
(so, more than 60 Seconds are allowed in the Seconds-param, but also negative Values in any of the params will work)
It will return a VB-DateType from the calculated Sum, which you can then use to e.g.:
- derive a Double-Value from it (in case you want to do math "on Minutes in Double-Format)
- or (for String-conversion) you can pass the TimeSerial-DateType-ReturnValue to the Format-Function like this
Debug.Print Format(TimeSerial(0, 0, 62), "hh:mm:ss")
HTH
Olaf
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
|