I get the date / time as a double value from C # (DateTime.ToOADate (), which is OLE Date Time). It contains past days from 1899/12/31, while part is a passing part of the day. Multiplying from 86400, I get seconds and from this, finally, in the daytime.
Getting the date, however, is more difficult. I still do not have a solution, except for the terms for which UNIX time extends (1970/01/01 - 2038/01/19). During this time, mktime () can be used to convert past days to date and time.
double OleDateTimeValue = 28170.654351851852;
struct tm * timeinfo;
int passedDays = (int)OLEDateTimeValue;
if((passedDays >= 25569) && (passedDays <= 50423))
{
timeinfo->tm_year = 70;
timeinfo->tm_mon = 0;
timeinfo->tm_mday = 1 + (passedDays - 25569);
mktime(timeinfo);
}
else
{
}
Now mktime () formats the tm structure so that it represents the requested date, or returns -1 if the value is outside the dates.
? , MFC Visual ++ 6.0.
,