hi,
I need to convert a date time value to file time, i tried this ....
FILETIME ft = new FILETIME();
//from System.DateTime to System.Runtime.InteropServices.ComTypes.FILETIME
/////////////////////////////////////////////////////////////////
long hFT1 = DateTime.Now.ToFileTime();
ft.dwLowDateTime = (int)(hFT1 & 0xFFFFFFFF);
ft.dwHighDateTime = (int)(hFT1 >> 32);
/////////////////////////////////////////////////////////////////
in order to check that conversion is right I converted file time back to date time using this code ...
/////////////////////////////////////////////////////////////////
//from System.Runtime.InteropServices.ComTypes.FILETIME to System.DateTime
/////////////////////////////////////////////////////////////////
long hFT2 = (((long)ft.dwHighDateTime) << 32) + ft.dwLowDateTime;
DateTime dte = DateTime.FromFileTime(hFT2);
but this 'dte' is a wrong value.
i think the problem is : FILETIME.dwLowDateTime is a signed int and if 32nd bit of long value is '1' , the FILETIME.dwLowDateTime is converted to negative value.
PLz help me for correct conversion of datetime to filetime.
Regards,