Solved

Filetime to Date in C#

Posted on 2004-09-01
2
1,847 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
Comment Utility
0
 

Author Comment

by:SiraX
Comment Utility
Exactly what I need =)

Thank you very much for the quick and right answer
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
canBalance challenge 34 64
copyEvens challenge 6 63
changePi Challenge 15 75
PHP question(s) about order of output 9 38
I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
This is about my first experience with programming Arduino.
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 …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now