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

Recommended Answers

All 2 Replies

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.