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

How to manipulate time in VB?

Status
Not open for further replies.

229257

Programmer
Apr 23, 2002
54
GB
Hi,

I'm querying some time values from an Access DB in VB, the format that the time is in looks like is 12:21:20, hh:mm:ss. I would like to simply add or subtract a minute on the time meeting a certain conidition e.g. 12:21:20 + 00:01:00 but all i get is a mismatch message. I think it would help if I stored the time in a variable before manipulating it but what variable type do i use?

Any help would be much appreciated.

Thanks
 
Here's an example;

Dim tempStartTime as string
'dont think is correct but couldnt think a suitable one.

tempStartTime = DatGeneralAmIns.recordset!starttime
'now holds 10:02:00

tempStartTime = tempStartTime + 00.01

Any ideas? thanks.
 
Check out the DateAdd Function

tempStartTime = DateAdd("n", 1, tempStartTime)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top