473,401 Members | 2,127 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,401 software developers and data experts.

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

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
3 2211
Luuk
1,047 Expert 1GB
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
SioSio
272 256MB
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
214 Expert 128KB
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

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

Similar topics

3
by: Jonas | last post by:
Dear members, How can I use a function return value in a regexpr? $tmp=~s/mysearch/myfunction($1)/; sub myfunction { return $v; }
5
by: Hitesh Patel | last post by:
hi friends, read following code and my problem. class B { private: public: void fun1(void) {
1
by: Tropos | last post by:
Query: Will a MutexGuard object release before a function return value is copied? Consider the C++ code: class MutexGuard //A familiar sort of class for making mutexes exception-safe { . ....
7
by: Michael Klatt | last post by:
class Foo { public : explicit Foo(int i) : m_int(i) {} private : int m_int; }; Foo f(int i)
8
by: Michel Rouzic | last post by:
I'm sure that it's a dumb problem where i surely did something dumb, but, I got a problem, I got a variable that we'll call var1. in the main() function, this variable var1 (of type unsigned) of a...
3
by: startsmart | last post by:
Hi This is first time to write and alse it is first time to show this site my problem is i need to pass value from any input type like text for example to hidden field I tried to make a...
4
by: pradeep | last post by:
Hello friends ~ We know that a C function will return a 32-bit value from a function in %eax and a 64-bit value in %edx:%eax. But what about larger return types, for example large structs? The...
6
by: kurt.krueckeberg | last post by:
Can someone explain why this line $bool = isset($_POST) && !empty(trim($_POST)); causes the error message "Can't use function return value in write context". trim() returns a string. I test if it...
1
by: Rajib | last post by:
Not that this serves any real purpose, but gcc allows me to do some hack like this: class hide_A { public: class A { public: virtual int final() { return 42; } };
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.