Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

datetime picker

Status
Not open for further replies.

jayjay60

Programmer
Jun 19, 2001
97
0
0
FR
In my application(a dlgbox) i need to compare date in a database. The dates in the database look like that:"07/08/01". In the dlgbox, i put a date time picker, with short date style, and the variable linked to it is a COleDateTime m_dlgDate. So, i need to compare the dates in database m_dlgDate. But even if apparently we could find the same date, a COleDateTime variable consider the time too. This is my problem, because with this consideration i will never find the same date. Is anybody could explain how to solve it?

jayjay
 
Hi,

COleDateTime time(70, 12, 18, 17, 30, 0);
// 18 December 1970, 5:30 PM
CString s = time.Format(VAR_DATEVALUEONLY);
// s contains the date formatted based on
// the current national language specifications
// (locale ID). The time portion is ignored for
// formatting purposes in this case.

Use the Format function to convert the COleDateTime object to string and then u can convert the database field to string and compare the two values.

Hope this will help you.


hsk007 :cool:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top