# pragma warning (push)
# pragma warning (4127) disable://conditional expression constant
ATLENSURE (nYear & gt;=1900);
ATLENSURE (nMonth & gt;=1 & amp; & NMonth & lt;=12); //interrupt after the jump to the line
ATLENSURE (nDay & gt;=1 & amp; & NDay & lt;=31);
ATLENSURE (nHour & gt;=0 & amp; & NHour & lt;=23);
ATLENSURE (nMin & gt;=0 & amp; & NMin & lt;=59);
ATLENSURE (nSec & gt;=0 & amp; & NSec & lt;=59);
From below list control string types of time, in the list of time from a database, and then fill the time to the date, time control
Cstrings time1=m_listDisp. GetItemText (I, 4);
Sscanf (time1, "% d % d - % d % d: % d: % d", & amp; NYear, & amp; NMonth, & amp; NDate, & amp; NHour, & amp; NMin, & amp; NSec);
CTime strTakeoffDate (nYear, nMonth nDate, 0, 0, 0).
CTime strTakeoffTime (nYear, nMonth nDate, nHour, nMin, nSec);
M_TakeoffDate=strTakeoffDate;//fill in the date control
M_TakeoffTime=strTakeoffTime;//time to fill in the
controlDon't know where the problem is, the date of the database are legally date
Pictures of date control and time control
CodePudding user response:
Breakpoint debugging and see how much the value of each variable is not understoodCodePudding user response:
Print out the date on which the information is whatCodePudding user response:
Time is so save in the database: 2017/1/1 21:00:00To achieve the first time controls access to date: 2017-1-1
The second access time: 21:00:00
CodePudding user response:
Problem solved, VC6.0 date format and WIN10 vs inside,VC6.0 to WIN10 became 2016/1/1 below 2016-1-1
Thank you all for a master!!!!!!