Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Donate Today!

Do you enjoy these
technical forums?
Donate Today! Click Here

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

peglin (IS/IT--Management)
23 Aug 02 13:59
Hi. how do I compute the difference between two times? In the result, I want to see the hour difference and minute difference as HH:MM, not just the hour or minute. the time1 and time2 are formatted 'YYYY-MM-DD HH:MM:mm.ss'. I only want the HH:MM part from the computed difference. Thank you.
Tentacle (Programmer)
24 Aug 02 3:25
Try the SecondsAfter function, it gets the number of seconds one time occurs after another. Syntax :

SecondsAfter ( time1, time2 )

Then just devide by 60 for minutes and 60 again for hours... hope this helps
PowerObject (Programmer)
24 Aug 02 3:36
Hi,

Your solution to your problem is to use the SecondsAfter() function. It returns a long value of seconds being the difference between the two time values. To conver this value to a time format, just use the String() function to format the computation:

//////////////////////////////////////////////////////////
time   lt_Time1, lt_Time2 ;
long   ll_Secs ;
string ls_Diff ;
//
ll_Secs = SecondsAfter( lt_Time1, lt_Time2 ) ;
//
ls_Diff = String(( ll_Secs / 60 ) / 60 ) + ":" + String( ll_Secs / 60 )
//////////////////////////////////////////////////////////

Hope this helps...

--
PowerObject!
-----------------------------------------
http://groups.yahoo.com/group/PowerObject
PowerBuilder/PFC Developers' Group

PowerObject (Programmer)
24 Aug 02 18:43
Hi Peglin,

I hate to offer any code that is not from a real-world situation. The above code I posted yesterday does have some glitches. However, you have posted the same question onto another group and I posted a bug-free solution out there. Just surf to:

   [a href="http://groups.yahoo.com/group/PowerObject/message/355";]http://groups.yahoo.com/group/PowerObject/message/355[/a]

Regards,

--
PowerObject!

peglin (IS/IT--Management)
26 Aug 02 9:30
Thank you for your help. I'll try that out. Thanks again.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close