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

I need a function to get final value in min.sec.

P: 1
Substract 82.30 - 72.50 (Type Degree)
Answer require : 09.40 (Type Degree)
Multiply : 09 x 4 Second
Ans : 36 Min
Multiply : 40 x 4 Second
Ans : 160 Second
convert : 36 Min.160 Sec
as 36 Min. + 2 Min 40 Second
Final Ans require : 38 Min. 40 Sec
May 20 '19 #1
Share this Question
Share on Google+
3 Replies


Expert 100+
P: 1,039
Can you explain in words what you are trying to do?
I am alrady loast at your second sentence:
"Answer require : 09.40 (Type Degree)"

You need a 'final value in min.sec', but do not specify what 82.30 and 72.50 is.

What correlation has 'Degree' with min.sec. ?
May 20 '19 #2

100+
P: 112
Conversion from Integer type to TimeSpan Type
Expand|Select|Wrap|Line Numbers
  1. Dim imin As Integer = 82
  2. Dim isec As Integer = 30
  3. Dim ts1 As New TimeSpan(0, imin, isec)
Time calculation (adjustment)
Expand|Select|Wrap|Line Numbers
  1. Dim ts1 As New TimeSpan(0, 82, 30)
  2. Dim ts2 As New TimeSpan(0, 72, 50)
  3. Dim ts3 As TimeSpan = ts1 - ts2
Convert
Expand|Select|Wrap|Line Numbers
  1. Dim ts3 As New TimeSpan(0, 36, 160)
Time calculation(multiplication)
Expand|Select|Wrap|Line Numbers
  1. Dim L As Long  = ts1.Ticks * 7
To Striing
Expand|Select|Wrap|Line Numbers
  1. Dim min As String = Mid(ts3.ToString,4,2)
  2. Dim sec As String = Mid(ts3.ToString,7,2)
Dec 16 '19 #3

cactusdata
P: 80
You can handle your degrees as timespans:

Expand|Select|Wrap|Line Numbers
  1. Dim StartValue As TimeSpan = New TimeSpan(0, 72, 50)
  2. Dim StopValue As TimeSpan = New TimeSpan(0, 82, 30)
  3.  
  4. Dim Factor As Double = 4
  5. Dim Final As TimeSpan = TimeSpan.FromSeconds(StopValue.Subtract(StartValue).TotalSeconds * Factor)
  6.  
  7. Console.WriteLine(Final.ToString("mm':'ss"))
  8.  
  9. ' -> 38:40
Dec 16 '19 #4

Post your reply

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