Solved

Subtract time from time

Posted on 1998-11-11
2
171 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MsgBox 2 65
Publisher:   Unknown     VB.exe Application 1 31
VB6 common control 6 sp6 object library not registerd 3 63
Problem to line 23 80
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

734 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