473,890 Members | 1,690 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to convert FILETIME to DateTime?

I know, general answer for my question is:

long hFT2 = (((long) ft.dwHighDateTi me) << 32) + ft.dwLowDateTim e;
DateTime dte = DateTime.FromFi leTimeUtc(hFT2) ;

where dwHighDateTime/dwLowDateTime is field of FILETIME structure. But!
I call FindFirstFile and receive FILETIME structure with value(for
ftLastAccessTim e field):
High = 29777898
Low = -2072184854
Yes, low IS negative since FILETIME IS pair of int, not uint. How from
these values I can get "14/04/2006 23:15:20" (LastAccessTime in local
time)? Code from above just throw exception!
Apr 15 '06 #1
1 3890
Sorry, it was my wrong! "Conjuratio n"
long hFT2 = (((long) ft.dwHighDateTi me) << 32) + ft.dwLowDateTim e;
DateTime dte = DateTime.FromFi leTimeUtc(hFT2) ;

work just fine. Thanks to all. :)
Apr 15 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: simon | last post by:
I have datetime variable: Datetime tsEndTime; Should I use (DateTime): tsEndTime=(DateTime)rdr.GetValue(15) or is better to use: tsEndTime=Convert.ToDateTime(rdr.GetValue(15))
by: aunthas | last post by:
I want to play sound using winapi, so I wrote these lines of code:- ------------------------------------------------------------------------------------------------------------------- using namespace System; using namespace System::Runtime::InteropServices; namespace WavAPI { extern "C" bool sndPlaySound(String* lpszSound, unsigned int fuSound);
by: yxq | last post by:
There are 8 bytes binary value stored date and time in Registry. 84 8B D7 DF 8B 28 C5 01 I want to convert the binary value to date using VB.NET. Dim a As FILETIME a.dwHighDateTime = 29698187 '(01C5288B to decimal) a.dwLowDateTime = -539522172 '(??????? by 84 8B D7 DF) MsgBox (GetFileToSystemDate(a, False))
by: msavazzi | last post by:
Hi, it should be simple, put FILETIME in a Long conver it in date using the DateTime.FromFileTimeUtc The help even says: Converts the specified Windows file time to an equivalent UTC time. Now why happens this:
by: iulian.ilea | last post by:
Is correct to have a varchar field and insert dates of type dd/mm/yyyy into it? I choose this method because I have an application that runs on more than one server. So, if I used a datetime field (MSSQL Server) it worked on my test machine. If I run the same application on another machine with different regional settings is not working. I tried with date_default_timezone_set to change timezone but is not changing. After...
by: rob.zumwalt | last post by:
Hi All, I have written a wrapper around a C++ class to make it available to C#, built into a dll. This has gone just fine, but one of the methods in the C++ class takes a FILETIME pointer as an argument (from windows.h). For example: timer.h (C++) ------------ #include "windows.h"
by: groups | last post by:
This is my first foray into writing a generic method and maybe I've bitten off more than I can chew. My intent is to have a generic method that accepts a value name and that value will be returned from the source. My first attempt was as follows; (please ignore that error handling is not present in this example) public T GetValue<T(string objName) { T results;
by: nabil035 | last post by:
hi, wel I have these vars: double day,month,year,hour,minute,second,millisecond; I want to convert this data to a filetime structure, I don't want of course to convert them manually please help
by: PeteOlcott | last post by:
I need to convert time_t to System::DateTime. All of the examples that I found are either in C# or in the obsolete managed C++ syntax. What is the current syntax for converting a (probably 64 bit) time_t value to System::DateTime ???
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.