# 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 ....

ZachSmith

What data type are the times held in?

decimal
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
p_davis

membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.

membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.