Solved

Subtract time from time

Posted on 1998-11-11
2
179 Views
Last Modified: 2010-04-30
Hi,

I have a total mental block today and need help with this "simplistic" problem...

I have a counter ie "01:00:00". I need to subtract say "00:54:32" from it, giving me the total counter (time) remaining in hh:mm:ss format.

The counter is NOT AM/PM dependant, so using TimeSerial, or TimeValue does not work. Can someone help me out please?

Many thanks.

Kind regards,
   Tony Jones, Queensland, Australia
0
Comment
Question by:netcard
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
Sendoh earned 80 total points
ID: 1444438
Hi !

I assume the two source were string cuz you didn't stated cleary what are the type of input and the types of output expected. My proposed answer were :

Private Sub Command1_Click()
    Dim a1 As String
    Dim a2 As String
   
    a1 = "01:00:00"
    a2 = "00:54:32"
    MsgBox Format(CDate(a1) - CDate(a2), "hh:mm:ss")
End Sub
The message pops "00:05:28".
0
 

Author Comment

by:netcard
ID: 1444439
You are an absolute life saver! Thank you very much indeed for a great answer and a damned fast one <g>

All the best.

Kind regards,
    Tony Jones, Queensland, Australia
    Southern Cross Visual Basic Code and Links
    http://www.geocities.com/capecanaveral/6740/

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month10 days, 3 hours left to enroll

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question