1. ## TTime to TTimeIntervalSeconds

Hi,
Am using CAknTimeOrDateSettingItem class for getting the Date in TTime object. I need to know how to convert date to TTimeIntervalSeconds.

Thanks,
Sruthi

2. ## Re: TTime to TTimeIntervalSeconds

Date to TTimeintervalseconds ? or you want to convert the time to seconds.?

TTime time;
// some code to get/set time
TDateTime datetime = time.DateTime();
and from datetime object you can retrive all information from TTime like day, month, year , hour,minut,second etc.

Peter

3. ## Re: TTime to TTimeIntervalSeconds

Check whether this would be helpfull.

DateAndTimeHandlingExampleCode.guide.html

Priju

4. ## Re: TTime to TTimeIntervalSeconds

Please check sdk \Examples\base\dateandtime\basics the all information are there man!

Regards,
Parag Purkar

5. ## Re: TTime to TTimeIntervalSeconds

Hi all,
thanks for the speedy reply... What am concerned is getting TTime object to TTimeintervalseconds. Can i use Int64() for getting time object in microseconds.

6. ## Re: TTime to TTimeIntervalSeconds

Yes, but where is your baseline for the time you are finding the interval for?

You need a reference point

7. ## Re: TTime to TTimeIntervalSeconds

TTime aTime;

Here we got both time and date values in aDate and aTime. We need to get a specific time in TTimeIntervalSeconds from these two parameters. We need this value for setting an alarm. hope you got my point...

Sruthi

8. ## Re: TTime to TTimeIntervalSeconds

As i understood you need to get the difference in seconds.
Then i think you need to find the differences seperatly and has to added up after to get in seconds.

Peter

9. ## Re: TTime to TTimeIntervalSeconds

hi..
You mean i need to use SecondsFrom() function of TTime to get the difference in seconds.

10. ## Re: TTime to TTimeIntervalSeconds

AFAIK you need to use that function find the difference in seconds. But i think it will only get the difference between seconds. For minutes you need to use MinutesFrom() and so on.

11. ## Re: TTime to TTimeIntervalSeconds

Hi peter..
Sorry i think you didnt get my point clearly.. What you said is right. my problem is that i have two date . for example say first one is 24/06/2006 13:13(hour:minute). Let this date be the current date and time. the next time be 25/07/2007 10:10. So i need to get the difference between these time period in TTimeIntervalSeconds to pass it to the engine. i dont know if its possible or not. Please guide me.

12. ## Re: TTime to TTimeIntervalSeconds

AFAIK there is no such function to find the difference in second between two dates. And i think you need to find differnce in hours, minutes etc seperatly and convert those in to seconds and add up to get the total interval in seconds.

May some experts may get back to you if there is one for that.

Regards,
Peter

13. ## Re: TTime to TTimeIntervalSeconds

Originally Posted by sruthimp
Hi peter..
Sorry i think you didnt get my point clearly.. What you said is right. my problem is that i have two date . for example say first one is 24/06/2006 13:13(hour:minute). Let this date be the current date and time. the next time be 25/07/2007 10:10. So i need to get the difference between these time period in TTimeIntervalSeconds to pass it to the engine. i dont know if its possible or not. Please guide me.
So SecondsFrom seems to be ideal function for the scenario mentioned by you.
So it would look something like this:
Code:
```_LIT(KFirstTime,"20060624:131300.000000");
_LIT(KSecondTime,"20070725:101000.000000");
TTime firstTime(KFirstTime);
TTime secondTime(KSecondTime);
TTimeIntervalSeconds diffSecs;
firstTime.SecondsFrom(secondTime,diffSecs);```
--Mayur.

14. ## Re: TTime to TTimeIntervalSeconds

TTimeintervalSeconds diff;
TTime date1;
TTime date2;

date1.HomeTime();
date2.UniversalTime();
date1.SecondsFrom(date2, diff);

// diff now has difference in seconds between dates

15. ## Re: TTime to TTimeIntervalSeconds

Thanks for clearing me Paul and Mayur. I understand the concept now exactly.

Thanks and regards,
Peter

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•