Re: Can't get EncodeDate function to work.

Posted by Jerry on August 10, 2007

In Reply to Can't get EncodeDate function to work. posted by Warwick Weston Wright on August 10, 2007

: Function STFuncs.IsValidDateDV(SenderDV:String):Boolean;
: var
: TmpOut:TDateTime;
: FmtSettings:TFormatSettings;
: MyYY,MyMM,MyDD:Word;
: begin
: FormatDateTime(FmtSettings.ShortDateFormat,TmpOut,FmtSettings);
: GetLocaleFormatSettings(8, FmtSettings);
: IsValidDateDV:=True;
: DecodeDate(25194,MyYY,MyMM,MyDD);
: TmpOut:=EncodeDate(MyYY,MyMM,MyDD);
: end;
:
: The Above Code Snippet doesn't return a propper 'TmpOut' Value. I can use the 'TryEncodeDate' function successfully but I don't need it for this particular part of my program as I pride myself on good programming habbits. Also this code does not return an exception. I am currently using Delphi 2007 Professional(Update 2)

Quite confusing to me...

1. You don't use the value of parameter SenderDV, so what is the purpose of it?

2. None of the 3 parameters that you pass to FormatDateTime has been initialized at that moment.

3. You don't use the return value of FormatDateTime, so what's the use of it?

4. You don't use the values that are retieved by GetLocaleFormatSettings.

5. You write that your function doesn't return a correct "TmpOut" value. However, in your code you always return a Boolean value of True (with the line: IsValidDateDV:=True;) that has nothing to do with TmpOut.

Is this a joke?

Related articles

       

Follow Ups