Date

Compare

Description

Allows the comparison of two dates. This uses the same comparison logic as Family Historian Queries do. It is used for list sorting, and it will sort "March 1991" before 5th March 1991.

Syntax

iResult = dt:Compare(dtCompareDate)

Parameters

dtCompareDate
Date Object: Date to which this date is compared

Return Value

iResult
integer:
  • -1: this date is less than comparison date.
  •  0: this date equal to comparison date.
  •  1: this date is greater than comparison date.

Remarks

In this example the message box will always be shown:
dtBirthDate = fhNewDate(2010)
dtDeathDate = fhNewDate(1910)
iresult = dtBirthDate:Compare(dtDeathDate)
if  iresult > 0 then
   fhMessageBox('Birth Date after Death Date')
end