0

Hi,

I'm trying to convert the timebetween into a decimal, so i can calculate salary.

        `var
            TLogIn: TextFile;
            sLine, sTIn, sTOut,sUser,sTimeOut,sTimeIn,YourHMStr: string;
             iPosHash, iPosComma, iLength, iTimeIn,iTOut, iWage,iTimeOut:integer;
            TimeOut,dtDiff,TimeIn:TTime;
            rTime: real;
            d1, d2 : TDatetime;
            Begin
          //d2 := StrToTime(time());

          TimeOut:= Time();
          AssignFile(TLogIn,'LogInTime.txt');
          reset(TLogIn);

          while NOT eof(TLogIn) do
          begin
Readln(TLogIn,sLine);
iPosHash:= Pos('#',sLine);
iPosComma:= Pos(',',sLine);
iLength:= Length(sLine);
sUser:= Copy(sLine,1,iPosHash-1);
sTimeIn:= Copy(sLine,iPosHash+1,iLength-3);

TimeIn:=  StrToTime(sTimeIn);
 ShowMessage(TimeToStr(TimeIn-d2));
// iWage := HoursBetween(TimeOut,iTimeIn);
 dtDiff:= TimeOut- TimeIn;

 // rTime:= "Gen"

lblWage.Caption:= TimeToStr(dtDiff);
      end;
      end;`

i have stored the log in time in textfile. and im planning on multipying every hours by 180. Can you please help

3
Contributors
2
Replies
15
Views
3 Months
Discussion Span
Last Post by Bhavik_3
0

Just a few issues here with your post. Formatting is non-existant (read https://www.daniweb.com/welcome/rules ) and is there a language called "programming"? You need to tag with the language or tell us in your post so folk will know instead of guess.

Also, I can't guess why hours is multiplied by 180. I've used 60 minutes per hour, but 180 needs some explaining.
Finally https://www.google.com/search?q=c%23+time+calculation if I guessed the language right has a lot of prior material.

0

Thank you sharing this nice infromation with us. This helpful for many people.

Edited by happygeek: sig removed from post

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.