The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: Mr Earl on June 07, 2007, 01:30:05 PM

Title: DateTimePicker, GetFileTime output formats
Post by: Mr Earl on June 07, 2007, 01:30:05 PM
Is there a function to compare "DateTimePicker" output to "GetFileTime" output, or to convert the outputs to the same format?
Title: Re: DateTimePicker, GetFileTime output formats
Post by: Darrel on June 07, 2007, 02:05:46 PM
I have no idea what format DateTimePicker is in, but you might try FileTimeToSystemTime or SystemTimeToFileTime.

HTH,

Darrel
Title: Re: DateTimePicker, GetFileTime output formats
Post by: sinsi on June 07, 2007, 02:28:57 PM
DateTimePicker.Value is a DateTime
Quote
The DateTime value type represents dates and times with values ranging from 12:00:00 midnight, January 1, 0001 Anno Domini (Common Era) through 11:59:59 P.M., December 31, 9999 A.D. (C.E.)

Time values are measured in 100-nanosecond units called ticks, and a particular date is the number of ticks since 12:00 midnight, January 1, 0001 A.D. (C.E.) in the GregorianCalendar calendar. For example, a ticks value of 31241376000000000L represents the date, Friday, January 01, 0100 12:00:00 midnight. A DateTime value is always expressed in the context of an explicit or default calendar.

so use DateTime.ToFileTime ??? I got a bit lost in all the C++/C#/VB/net stuff, so have a look at
http://msdn2.microsoft.com/en-us/library/system.datetime.tofiletime.aspx

The only trouble I can see is that GetFileTime returns since January 1, 1601 (UTC) and not January 1, 0001.
Title: Re: DateTimePicker, GetFileTime output formats
Post by: Mr Earl on June 07, 2007, 03:15:42 PM
Thanks, SystemTimeToFileTime should do it.  The output of "DateTimePicker"  are ascii chars from a "GetDlgItemText" on the control, which I guess I'll have to manually insert into a SYSTEMTIME structure, then use SystemTimeToFileTime
Title: Re: DateTimePicker, GetFileTime output formats
Post by: farrier on June 07, 2007, 06:26:35 PM
Mr Earl,

Use SendMessage to send a DTM_GETSYSTEMTIME to the DTP and it will return a SYSTEMTIME.

hth,

farrier
Title: Re: DateTimePicker, GetFileTime output formats
Post by: donkey on June 08, 2007, 02:06:14 AM
Quote from: Mr Earl on June 07, 2007, 01:30:05 PM
Is there a function to compare "DateTimePicker" output to "GetFileTime" output, or to convert the outputs to the same format?

Hi,

You will have to convert them to the same format, FileTime is the best for that for reasons that will become apparent. The function SystemTimeToFileTime (http://msdn2.microsoft.com/en-us/library/ms724948.aspx) is used to convert from the SystemTime format to FileTime format. Once you have them both in FileTime format you can use CompareFileTime (http://msdn2.microsoft.com/en-us/library/ms724214.aspx) to compare the two times.