How 2 chk TTime object contains date & time in correct format

Login to reply to this topic.
Thu, 2007-09-27 15:08
Joined: 2007-05-24
Forum posts: 22

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


Thu, 2007-09-27 15:30
Joined: 2005-11-20
Forum posts: 1154
How can it be wrong?

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

Thu, 2007-09-27 16:46
Joined: 2004-11-29
Forum posts: 1156
Re: How 2 chk TTime object contains date & time in correct forma

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.

Fri, 2007-09-28 22:46
Forum Nokia Champion
Joined: 2005-08-31
Forum posts: 124
Re: How 2 chk TTime object contains date & time in correct forma

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

  • Login to reply to this topic.