From: <ah...@us...> - 2007-10-02 19:31:40
|
Revision: 11529 http://jvcl.svn.sourceforge.net/jvcl/?rev=11529&view=rev Author: ahuser Date: 2007-10-02 12:31:38 -0700 (Tue, 02 Oct 2007) Log Message: ----------- Added TryStrToDate Modified Paths: -------------- trunk/jvcl/run/JvVCL5Utils.pas Modified: trunk/jvcl/run/JvVCL5Utils.pas =================================================================== --- trunk/jvcl/run/JvVCL5Utils.pas 2007-10-02 08:57:34 UTC (rev 11528) +++ trunk/jvcl/run/JvVCL5Utils.pas 2007-10-02 19:31:38 UTC (rev 11529) @@ -136,6 +136,7 @@ function TryStrToInt(const S: string; out Value: Integer): Boolean; function TryStrToDateTime(const S: string; out Date: TDateTime): Boolean; +function TryStrToDate(const S: string; out Date: TDateTime): Boolean; function TryStrToTime(const S: string; out Time: TDateTime): Boolean; function StrToDateTimeDef(const S: string; Default: TDateTime): TDateTime; function StrToDateDef(const S: string; Default: TDateTime): TDateTime; @@ -851,6 +852,16 @@ end; end; +function TryStrToDate(const S: string; out Date: TDateTime): Boolean; +begin + Result := True; + try + Date := StrToDate(S); + except + Result := False; + end; +end; + function TryStrToTime(const S: string; out Time: TDateTime): Boolean; begin Result := True; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |