: : : : : : I used Date Type for my date fields:
: : : : : :
: : : : : : ...
: : : : : :
: : : : : : DateOfBirth:TdateTime;
: : : : : :
: : : : : : ...
: : : : : :
: : : : : : BUT you have to write month/date/year or else an error message appears;
: : : : : :
: : : : : : How can i change it to date/month/year?
: : : : : :
: : : : : You can create your own date string parser, which gives you 3 integer variable. It's not that difficult. Then you can use EncodeDate() to fill the TDateTime variable with the integer values.
: : : : :
: : : :
: : : : Can you tell me exactly how to do it. I have no idea
: : : :
: : : :
: : : If each of the number is always 2 digits long then this code should work:
: : :
: : : Day := StrToInt(DateStr[1]+DateStr[2]);
: : : Month := StrToInt(DateStr[4]+DateStr[5]);
: : : Year := StrToInt(DateStr[7]+DateStr[8]);
: : : Date := EncodeDate(Year, Month, Day);
: : :
: : : If there is variation in the formatting (like 4 digits per year, or 1 per day/month) then you'll need to design a better parser.
: : :
: : where would i insert that code. parser is a completely new word for me
: :
: A parser is a code or an object, which reads some data and can determine what it says. In this case the code I gave you here is a very simple parser which reads the variable DateStr and can convert it into an actual date in the memory.
: The Delphi compiler uses a parser object to read your source code and make sense of it, so that the compiler can change it into binary code.
:
there is actally a built in functon that i found.