Double variable manipulation and calculation

Hi,

I’ve built a data table from excel file. I’ve gathered 4 double variables (A,B,C and D) from the table and now I would need to make a calculation with the doubles and then convert the results into hours and minutes.

The calculation part works just fine. I’ve done that by assigning a variable Number(double) with value A-B-C-D (A minus B, minus C and minus D)

Now the Number is for example 2.25. How do split this into hours (2) and minutes (0.25*60=15)?

Thanks & BR

Mikko

Hi @MikkoL
Use split functions and loop it through for each item

Thanks
Ashwin S

Hi @MikkoL,

You’ll have to get the string representation of your double (myDouble.ToString), then split it using the dot (.) as a separator and then parse them back into double or integer to make the calculation you’re showing.

Could you explain why are you doing it like this? Have you considered using Datetime objects instead and do time calculation with them?

Best,

Pedro Arroyo

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.