×

Discussion Board

Results 1 to 15 of 15
  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    39

    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. #2
    Super Contributor
    Join Date
    Oct 2005
    Posts
    739

    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. #3
    Super Contributor
    Join Date
    Oct 2005
    Location
    Hyderabad,India
    Posts
    1,156

    Re: TTime to TTimeIntervalSeconds

    Check whether this would be helpfull.

    DateAndTimeHandlingExampleCode.guide.html

    Priju

  4. #4
    Regular Contributor
    Join Date
    Feb 2006
    Location
    India,Pune
    Posts
    311

    Re: TTime to TTimeIntervalSeconds

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

    Regards,
    Parag Purkar

  5. #5
    Registered User
    Join Date
    Feb 2005
    Posts
    39

    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. #6
    Super Contributor
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644

    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. #7
    Registered User
    Join Date
    Feb 2005
    Posts
    39

    Re: TTime to TTimeIntervalSeconds

    TTime aDate;
    TTime aTime;

    CAknMultiLineDataQueryDialog::NewL(aDate,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...

    thanks in advance,
    Sruthi

  8. #8
    Super Contributor
    Join Date
    Oct 2005
    Posts
    739

    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. #9
    Registered User
    Join Date
    Feb 2005
    Posts
    39

    Re: TTime to TTimeIntervalSeconds

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

  10. #10
    Super Contributor
    Join Date
    Oct 2005
    Posts
    739

    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. #11
    Registered User
    Join Date
    Feb 2005
    Posts
    39

    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. #12
    Super Contributor
    Join Date
    Oct 2005
    Posts
    739

    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. #13
    Super Contributor
    Join Date
    Jun 2004
    Location
    SymbianLand
    Posts
    763

    Re: TTime to TTimeIntervalSeconds

    Quote 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. #14
    Super Contributor
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644

    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. #15
    Super Contributor
    Join Date
    Oct 2005
    Posts
    739

    Re: TTime to TTimeIntervalSeconds

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

    Thanks and regards,
    Peter

Similar Threads

  1. Comparing TTime objects
    By sruthimp in forum Symbian
    Replies: 3
    Last Post: 2007-07-05, 14:24
  2. TTime : TInt64& Int64() problem in S60 3rd edition
    By iulian_moldovan in forum Symbian Tools & SDKs
    Replies: 3
    Last Post: 2006-01-24, 13:07
  3. writng TTime values to afile using RFileWriteStream
    By girish sharma in forum Symbian
    Replies: 1
    Last Post: 2005-01-27, 11:53
  4. Very strange TTime bug
    By bjorn.rudolfsson in forum Symbian
    Replies: 2
    Last Post: 2004-01-13, 15:10
  5. converting long value to TTime object
    By ramana9210 in forum Symbian
    Replies: 0
    Last Post: 2002-08-01, 10:45

Posting Permissions

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