Solved

Filetime to Date in C#

Posted on 2004-09-01
2
1,857 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
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article will show, step by step, how to integrate R code into a R Sweave document
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.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

735 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