Проверка правильности даты |
Previous Top Next |
Code: |
function DateExists(Date: string; Separator: char): Boolean; var OldDateSeparator: Char; begin Result := True; OldDateSeparator := DateSeparator; DateSeparator := Separator; try try StrToDate(Date); except Result := False; end; finally DateSeparator := OldDateSeparator; end; end;
procedure TForm1.FormCreate(Sender: TObject); begin if DateExists('35.3.2001', '.') then begin {your code} end; end; |
©Drkb::00195
Взято с Delphi Knowledge Base: http://www.baltsoft.com/
Code: |
function ValidDate(const S: String): Boolean; BEGIN Result := True; try StrToDate(S); except ON EConvertError DO Result := False; end; END
|
©Drkb::00738
DelphiWorld 6.0