Click here to Skip to main content
Sign Up to vote bad
good
See more: MFCDateTime
HI,
How to get Day, Month, Year from MFC DATETIMEPICKER
 
I need to save the Day, Month, Year from MFC DATETIMEPICKER as CString when the date is changed on DATETIMEPICKER.
I have added control variable to the date time picker button,
and added the action listener to that button control(OnDtnDatetimechangeDatetimepicker(NMHDR *pNMHDR, LRESULT *pResult)),
 
But how to get Day, Month and year from that control variable?
Thanks
Posted 20 Sep '12 - 17:30
Edited 20 Sep '12 - 17:36


1 solution

You Need to typecast pNMHDR to LPNMDATETIMECHANGE.Refer MSDN for NMDATETIMECHANGE
 
Sample code:
 
LPNMDATETIMECHANGE pDTChange = reinterpret_cast<lpnmdatetimechange>(pNMHDR);
CString strDDMMYYY;
strDDMMYYY.Format("DD::MM::YYYY %02d::%02d::%04d", pDTChange->st.wDay, pDTChange->st.wMonth, pDTChange->st.wYear);
</lpnmdatetimechange>
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Mahesh Bailwal 413
1 Sergey Alexandrovich Kryukov 384
2 Maciej Los 200
3 Aarti Meswania 193
4 Rohan Leuva 165
0 Sergey Alexandrovich Kryukov 9,417
1 OriginalGriff 7,204
2 CPallini 3,933
3 Rohan Leuva 3,211
4 Maciej Los 2,743


Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 21 Sep 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid