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!

how can calculate time in vb 6

Status
Not open for further replies.

darkdido

Programmer
Nov 23, 2005
8
SD
how can calculate time in vb 6
like..(30:30+20:15)=50:45
 
VB does not have a time data type. There is a date data type that has a time component.

I assume this to mean 30 minutes 30 seconds PLUS 20 minutes 15 seconds.

If so, then....

Dim dte1 As Date
Dim dte2 As Date

dte1 = CDate("0:30:30")
dte2 = CDate("0:20:15")

Debug.Print dte1 + dte2

You'll notice that the resutl is... 12:50:45 AM You'll need to format the final result to suit your style.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 


Hi,
Code:
MsgBox Format(TimeValue("00:30:30") + TimeValue("00:20:15"), "[h]:nn:ss")


Skip,
[sub]
[glasses] [red]Be Advised![/red]
The band of elderly oriental musicians, known as Ground Cover, is, in reality...
Asian Jasmine![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top