> I have a couple of thousand dates in string format ie '100999' in a
> database field. To convert to Date format I need to insert a charater
> as a date separator as defined by the date separator global variable.
> How do I get the "/" into the string so I can do a StrtoDate().
How about instead of changing the string format and then converting,
do it in one step...
function GetDateFromShortDateString(const S :String; Century
:Integer):TDateTime;
begin
result :=
EncodeDate(StrToInt(Copy(S,1,2)),StrToInt(Copy(S,3,2)),(Century*100)+StrToIn
t(Copy(S,5,2)));
end;
Or something like that...
NB Strictly speaking the doing
StrToDate(S[1]+S[2]+'/'+S[3]+S[4]+'/'+IntTostr(Century)+S[5]+S[6]);
might just enable the optimiser to do some tricks if the inlining of
Array[n]+Array[N+1] can be unified to
copying 2 array slots at once... Anyone know how strong the global
optimiser is in Delphi?
--
Aaron@home
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz