CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Posts
    388

    How to convert COldDateTime to CTime

    How can I convert COleDateTime object to CTime. I have another problem, please have a look at it.

    These classes give date also but I need only day time, how can I disable the year,month in this class. I need to do so because i have to compare times irrespective of dates.


  2. #2
    Join Date
    Apr 1999
    Posts
    306

    Re: How to convert COldDateTime to CTime

    Why don't you just create a new object of class CTime and then retrieve the needed vars from COleDateTime and copy then in the new object. I do not think I understand correctly your question so please be more specific if you want more specific answers.


  3. #3
    Join Date
    May 1999
    Posts
    388

    Re: How to convert COldDateTime to CTime

    I want to do the following:

    CTime t1, Const_Time1, Const_Time2;

    if ((t1>Const_time1) && (t1<Const_time2))
    {
    // do something, thats what I want to do!
    // ....
    }

    Now the follwing are my problems:
    (1). How can I set the Const_Time1 & 2 to a particular time. I can only set it with its contructor but is there any other way.

    (2) How to get t1 from user. I am using edit box and COleDateTime type to read, but then I need to convert it to CTime! If there is any other way please let me know. I want the user to give time in hr:min format.

    (3) In time comparison, It also compares dates along with it(which is part of the Ctime structure). I don't want this because it can spoil my results as I need a purely time comparsion.

    Please help me with these problems. It has taken quit time from me but I could not solved it yet. I will highly appreciate any help.

    Shahzad
    [email protected]


Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured