Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help converting string to time_t, please

Status
Not open for further replies.

bcemick

Programmer
Feb 16, 2005
6
US
I have an SDI program that has a dialog containing a list control. In one field of the list control, a date is to be displayed. It's received from another dialog as CTime and converted to a string for display.

How do I need take the string from the list control and convert it to time_t?

Any help is greatly appreciated.
 
I don't have a compiler on this computer, and I haven't had to do anything like that for a while, but here's how I think it can be done.

Take your string and convert it back to a CTime, or just store the CTime that the dialog originally gave you. Get the current time as a CTime and subtract them (I believe you can do that?) to get the difference. Convert the difference to seconds, and add it to whatever time() tells you is the current time
 
I was just popping in here to say "Never mind". It took a while, but I finally got it to work. Thanks for the reply though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top