Link to home
Start Free TrialLog in
Avatar of Tech_Men
Tech_MenFlag for Israel

asked on

time calculation to money

hi there ,
i have a 1 hour worth money for the sample is 19.95 for 1 hour of work
in the hour table i have start hour and end hour like this ;
08:30   - 10:00
the total is : 01:30 = hour and a half
in the monet i need to get this resualt : 29.92
how can i get this resualt ?
thanks ....


Avatar of ZachSmith
ZachSmith
Flag of United States of America image

What data type are the times held in?
Avatar of Tech_Men

ASKER

decimal
Avatar of p_davis
p_davis

it might be better to do a datetime type of the times and then you can

DateTime timeDiff = ((DateTime) EndTime.Subract(StartTime))
TimeSpan span = new TimeSpan(timeDiff.Day, timeDiff.Hour,timeDiff.Minute,0);

Int32 totalMinutes = span.TotalMinutes();

then you can divide by 60 to get the hour and the modulous is the mintues left over and multiply the wage accordingly
of course if the already datetime you can do away with the casting
DateTime timeDiff = ( EndTime.Subract(StartTime)
dangit
DateTime timeDiff = EndTime.Subract(StartTime)
my problem is not the time clac i am geting the time that i need to get
the problem is when i want to turn the time into money

If you have time in minutes
moeny = (time in minutes/60 )*19.95
will give you the wages.
is 1 hour sum is 20$
and i have 1.30 ( 1 hour and a half)
i need to get : 30$

know i am geting : 26$

i need to turn the 1.3 to 1.5 and then do the multiplay on it
if the total hour will be 1.45
i need go get : 27.5$
If you have it as decimial what you can do is
split the decimal value as 1 and 30
which will be hour and minutes

then multiply hour * 60 and add the minutes.

then apply
moeny = (time in minutes/60 )*20
SOLUTION
Avatar of p_davis
p_davis

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks all