Link to home
Create AccountLog in
Avatar of Tech_Men
Tech_MenFlag for Israel

asked on

calc minutes to houre

time calc problem
i have this resuat of time :
10.60
its need to be 11 hours
the .60 is minutes
its need to be turn to 1 houre
i do this code ant its work good :

decimal time =(decimal)10.60;
decimal t = time % 2;
textBox2.Text = t.ToString();
decimal res =(t/60) * 100;
time = time - t;
decimal tot = time + res;
textBoxEx2.Text=tot.ToString();

now if the total hour is 10.70 insted of 10.60
i need to get 11 hours and 10 min = 11.10
i am geting wrong resualt 11:16

how can i fix that ?
thanks ...
Avatar of surajguptha
surajguptha
Flag of United States of America image

Generally what are you using this code for? what are you trying to do ?
Avatar of Tech_Men

ASKER

i mange but i still have a small problem
if the diff is a round number
i need to add the number .00

i need to check if the num is round and if he is round i need to attach the .00
if i get the num 8
i need to change it to 8.00
thanks..
If you are looking to check if the number is round. you should look at Math.Round() function
ASKER CERTIFIED SOLUTION
Avatar of JimBrandley
JimBrandley
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
great