Using COledateTime in a record set in lieu of CTime
Posted on 2002-03-21
'm having a problem getting the date and time audit stamp into a new record of a data base.(using ODBC and CRecordsets).
The vendor has defined the fields as:
FT_DATE signed BCD('0YYYYMMDD') SIZE_OF_DATE (5 bytes)
FT_TIME signed BCD('0HHMMSSHH) SIZE_OF_TIME (5 bytes)
Time is a 24 hour clock: hours , minutes , seconds , hundreth of a second).
My recordset declares the two relevent variables as:
CTime m_dtASDate; // FT_DATE
CTime m_tmASTime; // FT_TIME
I need to stamp one filed with the date the other with the time.
The date isn't a probelm with:
CTime currd = CTime::GetCurrentTime();
int yr = currd.GetYear();
int mo = currd.GetMonth();
int day = currd.GetDay();
int hr = currd.GetHour();
int min = currd.GetMinute();
int sec = currd.GetSecond();
This gives me a date only field.
However,I can;t seem to isolate the time only.Whenever I try to enter the time I awlays end up with a complete (date and time) entry.
How can I isolate the time only from this?