-
May 15th, 2022, 04:23 AM
#1
How to get selected value from DateTimePicker? (Visual C++ 6 MFC)
Hello everybody! Nede some help - trying to get date from DateTimePicker, so the code is:
m_Date.GetStatus();
CString day;
day.Format("%i",m_Date.GetDay());
So variable "day" gets value "15" (today is 05-15-2022, it's correct) but I need to get selected value, for example, 05-04-2022 from this DateTimePicker - how to implement it? Thank you for answers.
-
May 15th, 2022, 07:20 AM
#2
Re: How to get selected value from DateTimePicker? (Visual C++ 6 MFC)
See https://docs.microsoft.com/en-us/cpp...vc-170#gettime
Code:
// assuming your m_Date is of the type CDateTimeCtrl
COleDateTime selectedDateTime;
if (!m_Date.GetTime(selectedDateTime))
{
// error
...
}
else
{
// success, now you can use COleDateTime::Format method to obtain the datetime value as text
...
}
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
|