NlMakesis Y-Browser Y-Tasks
Hi Guyes ,
How Should I chk TTime object contains date & time in correct format .
My Requirement :
User give me TTime object , Now I have 2 chk TTime object 4 its correctness & Execute some function
Thanks 4 Ur replay
Is a TTime object not always in correct format? Where do you see an incorrect date or time coming from?
I don't think the UI controls for date and time will allow the user to input something wrong and will give back this wrong value to your program.
René Brunner
The TTime class is just a 64 bit integer with the number or microseconds since "midnight, January 1st, 0 AD nominal Gregorian".
It doesn't have any format.
hi,
might this function will help u..
TInt CTestAppUi::CompareTime(TTime aTimeFst, TTime aTimeSnd) { const TInt EMinutesPerHour = 60;
TInt iRetVal(0); TInt iTimeFst = aTimeFst.DateTime().Hour() * EMinutesPerHour + aTimeFst.DateTime().Minute(); TInt iTimeSnd = aTimeSnd.DateTime().Hour() * EMinutesPerHour + aTimeSnd.DateTime().Minute(); if(iTimeFst == iTimeSnd) { iRetVal = 0; } else if(iTimeFst < iTimeSnd) { iRetVal = -1; } else { iRetVal = 1; }
return iRetVal; }
Regards, Mateen Maldar
Mateen Maldar
Forum posts: 1154
Is a TTime object not always in correct format? Where do you see an incorrect date or time coming from?
I don't think the UI controls for date and time will allow the user to input something wrong and will give back this wrong value to your program.
René Brunner
Forum posts: 1156
The TTime class is just a 64 bit integer with the number or microseconds since "midnight, January 1st, 0 AD nominal Gregorian".
It doesn't have any format.
Forum posts: 124
hi,
might this function will help u..
TInt CTestAppUi::CompareTime(TTime aTimeFst, TTime aTimeSnd)
{
const TInt EMinutesPerHour = 60;
TInt iRetVal(0);
TInt iTimeFst = aTimeFst.DateTime().Hour() * EMinutesPerHour + aTimeFst.DateTime().Minute();
TInt iTimeSnd = aTimeSnd.DateTime().Hour() * EMinutesPerHour + aTimeSnd.DateTime().Minute();
if(iTimeFst == iTimeSnd)
{
iRetVal = 0;
}
else if(iTimeFst < iTimeSnd)
{
iRetVal = -1;
}
else
{
iRetVal = 1;
}
return iRetVal;
}
Regards,
Mateen Maldar
Mateen Maldar