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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert character field to time

Status
Not open for further replies.

Rena

Programmer
May 24, 2000
69
US
Is there a function in VFP that will take a character field (which looks like HH:MM) and convert it to time.&nbsp;&nbsp;If not, I need to take an endtime field (which is char) and subtract it from a starttime field (which is also char) to get the total lapsed time.&nbsp;&nbsp;Anybody have any suggestions on how I can do this?<br><br>Thanks!
 
Check out or experiment with if you don't have the help file on:<br>CTOD() & CTOT() <p>John Durbin<br><a href=mailto: > </a><br><a href= > </a><br>ICQ VFP ActiveList #73897253
 
Hi John,<br><br>I played with the CTOT() function but got some wierd results.&nbsp;&nbsp;This is what I did.&nbsp;&nbsp;In the select statement I wrote:<br><br>(CTOT(endtime) - CTOT(starttime)) as prochours<br><br>it took end time = 7:44 - start time = 7:24 and stored 1200 in prochours.<br><br>What am I doing wrong?<br><br>Thanks for your help.
 
1200 is the result in seconds (not minutes).<br>You need to divide the result by 60 to convert it to minutes
 
Hi Medic,<br><br>I did finally figure that out (duh).&nbsp;&nbsp;Thanks for affirming it for me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top