Str2CutOffDate Function
Converts a string containing a Date into a DateTime.

Unit
QESBPCSDateTime

Declaration
Function Str2CutOffDate(const DateStr: string; const CutOff: Word): TDateTime;

Description
If the Item has no month and/or year then the current month and year will be assumed.

If a 2 Digit Year is used then CutOff is used to decide which century the date lies in. If 1900 + Yr less than CutOff then it is assumed that 2000 + Yr is wanted, otherwise 1900 + Yr is used.

Parameters
DateStr The String to convert.

Category
Date/Time Conversion Routines

Implementation

function Str2CutoffDate (const DateStr: string; const CutOff: Word): TDateTime;
var
     Hold1: TESB2DigitYr;
     Hold2: Word;
begin
     Hold1 := ESB2DigitYr;
     Hold2 := ESB2DigitCutOff;
     ESB2DigitYr := edyCutOff;
     ESB2DigitCutOff := CutOff;
     try
          Result := Str2Date (DateStr);
     finally
          ESB2DigitYr := Hold1;
          ESB2DigitCutOff := Hold2;
     end;
End;


HTML generated by Time2HELP
http://www.time2help.com