(1998*100)+1 = 3193 !!!
Posted on 1998-04-20
I am working on an accounting system and I need to have a feild which combines the year and month. I set up a function to get the value required:
function FetchMonth(Dt: TDateTime): LongInt;
var Y,M,D: Word;
Result := (Y*100)+M;
The result, given the date 01/01/1998, is 3193 instead of 199801. Why??? and how do I get the correct answer?
I tried using a LongInt variable to capture the answer before the result line, but I still got the same incorrect answer.
I am using D1 and Win 3.11.