compare current date with listed date
-
hai anybdy can help me.i have some keys that generated and stored in to text file. That key contain name and two dates like start date and end date.so now i want to compare the key with the given or enterd name is present in that txt file and if present compare the currentdate with dates given in the key.and give boolen like the current date exceed the end date or not? and start date less than the current date. can any body help me? regards shaanu
-
hai anybdy can help me.i have some keys that generated and stored in to text file. That key contain name and two dates like start date and end date.so now i want to compare the key with the given or enterd name is present in that txt file and if present compare the currentdate with dates given in the key.and give boolen like the current date exceed the end date or not? and start date less than the current date. can any body help me? regards shaanu
What is format of your date i.e. YYYY/MM/DD or something else.....
[Vote One Here, Complete my Survey....] Alok Gupta
visit me at http://www.thisisalok.tk "I Think Believe this Will Help" -
What is format of your date i.e. YYYY/MM/DD or something else.....
[Vote One Here, Complete my Survey....] Alok Gupta
visit me at http://www.thisisalok.tk "I Think Believe this Will Help" -
here is small code that compare current date with your stored date. My date Format is
YYYY-MM-DD
, i Believe,you are smart Enough to modify the code according to your need.BOOL ::FnCheckForValidDates(CString szEndDate)
{//Get Current date CTime TodayDate=CTime::GetCurrentTime(); int nYear,nMonth,nDay; //date format YYYY-MM-DD ///Extract Year nYear=\_ttoi(szEndDate.Left(szEndDate.Find('-'))); ///remove the Year from String szEndDate.Replace(szEndDate.Left(szEndDate.Find('-')),""); ///Replace Extra '-' szEndDate.TrimLeft('-');
///Extract Month
nMonth=_ttoi(szEndDate.Left(szEndDate.Find('-')));///remove the Year from String szEndDate.Replace(szEndDate.Left(szEndDate.Find('-')),""); ///Replace Extra '-' szEndDate.TrimLeft('-'); ///Extract Day nDay=\_ttoi(szEndDate); ///comparison Routine ///first Check year if(TodayDate.GetYear()>nYear) return FALSE; if(TodayDate.GetMonth()>nMonth) return FALSE; if(TodayDate.GetDay()>nDay) return FALSE;
#ifdef MYDEBUG
AfxMessageBox("Returning True");
#endifreturn TRUE;
}
[Vote One Here, Complete my Survey....] Alok Gupta
visit me at http://www.thisisalok.tk "I Think Believe this Will Help"