DbDate enhancements
Posted: Fri Mar 27, 2020 4:27 pm
Hi Robert,
would it be possible to add operator methods to the DbDate structure?
That would it make easier to work with the RDD object, for Core code that uses DBF files
Wolfgang
would it be possible to add operator methods to the DbDate structure?
Code: Select all
structure DbDate implements IDate
property Year as int auto get private set
property Month as int auto get private set
property Day as int auto get private set
property @@Value as DateTime get DateTime{Year, Month, Day}
property IsEmpty as logic get Month == 0
constructor(nYear as int, nMonth as int, nDay as int)
Year := nYear
Month := nMonth
Day := nDay
return
override method ToString() as string
if IsEmpty
return " - - "
endif
return self:Value:ToString("yyyy-MM-dd")
public static operator >( oDate1 as DbDate, oDate2 as DbDate ) as logic
return oDate1:Value > oDate2:Value
public static operator <( oDate1 as DbDate, oDate2 as DbDate ) as logic
return oDate1:Value < oDate2:Value
public static operator <=( oDate1 as DbDate, oDate2 as DbDate ) as logic
return oDate1:Value <= oDate2:Value
public static operator >=( oDate1 as DbDate, oDate2 as DbDate ) as logic
return oDate1:Value >= oDate2:Value
public static operator !=( oDate1 as DbDate, oDate2 as DbDate ) as logic
return oDate1:Value != oDate2:Value
public static operator ==( oDate1 as DbDate, oDate2 as DbDate ) as logic
return oDate1:Value == oDate2:Value
static method Compare( oDate1 as DbDate, oDate2 as DbDate ) as int
return System.DateTime.Compare( oDate1:Value, oDate2:Value )
override method GetHashCode() as int
return self:GetHashCode()
end structure
Wolfgang