-
November 8th, 2012, 02:19 PM
#1
Comparing dates of date and time picker control boxes
I have I have two date and time picker boxes with the same dates in them and when I get the date from them they give different result.
Code:
SYSTEMTIME st1 = {0}, st2 = {0};
int r;
r=SendMessage(hDepart, DTM_GETSYSTEMTIME, 0, (LPARAM)&st1);
if(r != GDT_VALID) Help("DTM_GETSYSTEMTIME error!");
r=SendMessage(hReturn, DTM_GETSYSTEMTIME, 0, (LPARAM)&st2);
if(r != GDT_VALID) Help("DTM_GETSYSTEMTIME error!");
union timeunion {
FILETIME fileTime;
ULARGE_INTEGER ul;
} ;
timeunion ft1;
timeunion ft2;
SystemTimeToFileTime(&st1, &ft1.fileTime);
SystemTimeToFileTime(&st2, &ft2.fileTime);
cout << "time " << ft1.ul.QuadPart << endl;
cout << "time " << ft2.ul.QuadPart << endl;
Why don't they give the same result? I would like to compare them.
-
November 8th, 2012, 02:50 PM
#2
Re: Comparing dates of date and time picker control boxes
Originally Posted by MasterDucky
I have I have two date and time picker boxes with the same dates in them and when I get the date from them they give different result.
...
Why don't they give the same result? I would like to compare them.
I'm confused.
Is the result different or the same?
And what is "the result" and what is it supposed to be?
Victor Nijegorodov
-
November 8th, 2012, 03:06 PM
#3
Re: Comparing dates of date and time picker control boxes
Hi Victor,
I should get the same result because they have the same dates in it.
But I get these two different values:
time 129968818494020000
time 129968818494290000
Thanks for your help!
-
November 8th, 2012, 03:08 PM
#4
Re: Comparing dates of date and time picker control boxes
And what values do they have?
Victor Nijegorodov
-
November 8th, 2012, 03:25 PM
#5
Re: Comparing dates of date and time picker control boxes
Well, the difference between these two times is 27 ms.
So how did you detect that the times in both datetime controls are equal?
Victor Nijegorodov
-
November 8th, 2012, 03:26 PM
#6
Re: Comparing dates of date and time picker control boxes
Today's date in this format: 08 / 11 / 2012 thursday
-
November 8th, 2012, 03:28 PM
#7
Re: Comparing dates of date and time picker control boxes
Originally Posted by MasterDucky
Today's date in this format: 08 / 11 / 2012 thursday
How did you set it to both controls? And when?
Victor Nijegorodov
-
November 8th, 2012, 03:40 PM
#8
Re: Comparing dates of date and time picker control boxes
I think it gets set automatically because I only send a DTM_SETFORMAT message when they are created. This is the format I use
LPSTR lpstrDate = "dd / MM / yyy dddd";
-
November 8th, 2012, 03:47 PM
#9
Re: Comparing dates of date and time picker control boxes
Then why do you think they dad to be equal?
Sur they are set not simultaneously but one after another while the creating the controls!
Just try to set the same datetime values to them using DTM_SETSYSTEMTIME message and see what will happen!
Victor Nijegorodov
-
November 8th, 2012, 04:01 PM
#10
Re: Comparing dates of date and time picker control boxes
Yes if I set them myself they are the same. :-)
That makes sense, thank you Victor!
-
November 8th, 2012, 04:02 PM
#11
Re: Comparing dates of date and time picker control boxes
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|