Yes, but how do Pythagoreans celebrate?
And do we need this knowledge in a time dimension in a data warehouse?
Code: Select all
FUNCTION IsPythagoreanDate(TheDate)
Ans = @NULL
If UnAssigned(TheDate) Or IsNull(TheDate) Then RETURN(Ans)
HumanDate = Oconv(TheDate, "D2-YMD")
Year = Field(HumanDate, "-", 1, 1)
Month = Field(HumanDate, "-", 2, 1)
Day = Field(HumanDate, "-", 3, 1)
Ans = @FALSE
* Pythagorean date not possible if any two components equal.
If Year = Month Or Year = Day or Month = Day Then RETURN(Ans)
Begin Case
Case Year > Month And Year > Day
Ans = ((Year * Year) = (Month * Month) + (Day * Day))
Case Month > Year And Month > Day
Ans = ((Month * Month) = (Year * Year) + (Day * Day))
Case Day > Year And Day > Month
Ans = ((Day * Day) = (Year * Year) + (Month * Month))
End Case
RETURN(Ans)