Subject Re: [ib-support] UDF using Delphi
Author Lele Gaifax
>>>>> Ariefn l'ha dit:

Ariefn> Hi all... I want to convert some types (TDateTime and
Ariefn> Float) into string. I have tried the following using
Ariefn> Delphi:

Ariefn> function
Ariefn> udf_FormatDateTime(StrFormat:string;aDateTime:TDateTime):PChar;
Ariefn> cdecl; export; begin
Ariefn> Result:=PChar(FormatDateTime(StrFormat,aDateTime)); end;

I'd use this function

function udf_TimeToString (StrFormat: PChar;
aDateTime: PDouble;
ResultBuffer: PChar): PChar; cdecl; Export;

declared in the database as

DECLARE EXTERNAL FUNCTION FormatDateTime
CSTRING(20), DOUBLE PRECISION, CSTRING(20)
RETURNS PARAMETER 3
ENTRY_POINT "udf_TimeToString" MODULE_NAME ...

Adapt the maximum length as needed.

hth,
ciao, lele.
--
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
email: lele@... | -- Fortunato Depero, 1929.