{*******************************************************}
{                                                       }
{       Administración de puntos de venta               }
{                                                       }
{       Copyright (C) 2006 Rodax Software S.L.          }
{                                                       }
{*******************************************************}

unit EDI_Utils;

interface

uses
  Controls;

function EDIDateToDateF (const ADate : string; const AFormat : string = 'yyyymmdd' ) : TDate;

implementation

uses
  SysUtils;

function EDIDateToDateF (const ADate : string; const AFormat : string) : TDate;
var
  aux : string;
begin
  if Length(ADate) = 0 then
    Result := 0
  else begin
    try
      if AFormat = 'yyyymmdd' then
        Result := EncodeDate( StrToInt(copy(ADate, 1, 4)), StrToInt(copy(ADate, 5, 2)), StrToInt(copy(ADate, 7, 2)) );
    except
      Result := 0
    end;
  end;
end;

end.
 