Solved

Filetime to Date in C#

Posted on 2004-09-01
2
1,858 Views
Last Modified: 2007-12-19
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.ByValTStr, SizeConst=256)]
            public String      fileName = null;
            [MarshalAs(UnmanagedType.ByValTStr, 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
0
Comment
Question by:SiraX
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 11

Accepted Solution

by:
lbertacco earned 500 total points
ID: 11954734
0
 

Author Comment

by:SiraX
ID: 11956072
Exactly what I need =)

Thank you very much for the quick and right answer
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question