const Date date1(0, 1, 1);
ASSERT(date1.IsValid());
const int n = date1.Get();
Date date2;
date2.Set(n);
ASSERT(date1 == date2);
I couldn't find description of an algorithm used in UPP, but other libraries (like BOOST) use Julian Day Number to convert date to a number of days. Algorithm for calculation seems to be much simpler in this case.