SiraX
asked on
Filetime to Date in C#
I've got a problem converting Filetime to Date in C#
I'm working with the Win 32 API and with the FtpFindFirstFile which return me ftCreationTime in FileData. I use this type as FileData:
public class FileData
{
public long fileAttributes = 0;
public FILETIME ftCreationTime;
public FILETIME ftLastAccessTime;
public FILETIME ftLastWriteTime;
public long nFileSizeHigh = 0;
public long nFileSizeLow = 0;
public long dwReserved0 = 0;
public long dwReserved1 = 0;
[MarshalAs(UnmanagedType.B yValTStr, SizeConst=256)]
public String fileName = null;
[MarshalAs(UnmanagedType.B yValTStr, SizeConst=14)]
public String alternateFileName = null;
}
This works (I think) but now I can't or I don't know how to convert this FILETIME to long (because when it would be long I could use DateTime.FromFileTime())
I already tried to use long or ulong instead of FILETIME but then it returns 0.
Thank you for your help
I'm working with the Win 32 API and with the FtpFindFirstFile which return me ftCreationTime in FileData. I use this type as FileData:
public class FileData
{
public long fileAttributes = 0;
public FILETIME ftCreationTime;
public FILETIME ftLastAccessTime;
public FILETIME ftLastWriteTime;
public long nFileSizeHigh = 0;
public long nFileSizeLow = 0;
public long dwReserved0 = 0;
public long dwReserved1 = 0;
[MarshalAs(UnmanagedType.B
public String fileName = null;
[MarshalAs(UnmanagedType.B
public String alternateFileName = null;
}
This works (I think) but now I can't or I don't know how to convert this FILETIME to long (because when it would be long I could use DateTime.FromFileTime())
I already tried to use long or ulong instead of FILETIME but then it returns 0.
Thank you for your help
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you very much for the quick and right answer