I'm trying to compare two DateTime objects, but I am receiving the following error.
error C2664: 'System:: DateTime::Compare' : cannot convert parameter 1 from 'System:: DateTime ^' to 'System:: DateTime'
I'm just trying to use the DateTime 'Compare' method to perform the check. Below is an example to illustrate what I'm trying to do
DateTime^ time1 = gcnew DateTime();
DateTime^ time2 = gcnew DateTime();
time1 = time1->Now;
time2 = time2->Now;
time2->AddHours(5) //add five hours to show difference;
int compareReturnValue = DateTime::Compare(time1 ,time2);
The Compare method should either return: 1,0,-1 depending on the comparision. I don't understand what I'm doing wrong. It would be so much easier if I could just do time1 > time2.
Any help, as always, is very much appreciated.