Sample Programs

DateObj A 16-bit Delphi Date/Time component (295K)

A useful date/time object for 16 bit Delphi programmers. This component is made up of two Delphi date/time values and their associated aggregate parts. Changing any one of the related values automatically updates any other related value.

Properties:

  • ErrorCode
  • Units
  • UnitsInterval
  • xDateTime
  • xDay
  • xDayOfWeek
  • xFormat
  • xHour
  • xIsLeapYear
  • xMinute
  • xMonth
  • xMSecond
  • xSecond
  • xText
  • xYear
  • yDateTime
  • yDay
  • yDayOfWeek
  • yFormat
  • yHour
  • yIsLeapYear
  • yMinute
  • yMonth
  • yMSecond
  • ySecond
  • yText
  • yyear

Example:

      {Get the date 90 days ago}
      DateObj1.xDateTime := Now;
      DateObj1.Units := Day;
      DateObj1.UnitsInterval := -90;
      DateObj1.Add;
      { Now DateObj1.yDateTime, DateObj1.yYear, DateObj1.yMonth - etc reflect the date 90 days ago}

      {Get the difference in hours between two dates}
      DateObj1.xDateTime := Date1;
      DateObj1.yDateTime := Date2;
      DateObj1.UnitsInterval := Hour;
      DateObj1.DateDiff;
      {Now DateObj1.Units = the difference between Date1 and Date2 in hours}

      {Validate/convert a string to a date}
      DateObj1.xText := Text1.text;
      {The error code will tell us if this was a valid date}
      {If it was, xDateTime = the date in Text1.text as does xYear, xMonth - etc.}
      if DateObj1.errorcode = EC_OK then
      ShowMessage(Text1.text + ' is a valid date')
      else
      ShowMessage(Text1.text + ' is not a valid date');


 
 
 
 
 

Powered by
Guatemalan Dark Roast