473,566 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

1 New Member
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 2221
Luuk
1,047 Recognized Expert Top Contributor
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 Contributor
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(mul tiplication)
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 Recognized Expert New Member
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
3440
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
1708
by: Hitesh Patel | last post by:
hi friends, read following code and my problem. class B { private: public: void fun1(void) {
1
2614
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 { . . . ~MutexGuard(); //releases the mutex when the stack pops
7
1946
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
1559
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 value of lets say 1000. now i got a function that we'll call func1, declared by void func1(unsigned var1) and called by func1(var1);. in this...
3
13472
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 function but it does not work function hdate(){
4
1643
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 only other spare register is %ecx because %ebx needs to be preserved, but that only brings the %possible total up to 96 bits. What happens after...
6
18984
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 is empty. So what is wrong with that?
1
1688
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
7666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7584
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8108
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7951
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6260
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2083
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.