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!

Time calculations? 2

Status
Not open for further replies.

MuraliKrishnaK

Programmer
Aug 20, 2001
8
IN
Hi, Friends

How to do time calculations in VB such as adding / subtracting two or three hours from the current time. Searching for the given time or time range from the database, etc.,

Murali Krishna
 
Text1 = DateAdd("h", 3, Time) will add 3 hrs to the current time.


strsQL = &quot;SELECT * FROM MyTable WHERE MyDateField > #09/01/01# AND MyDateField < #10/01/01#&quot;

David Paulson

 

Just adding to David's response...

Text1 = DateAdd(&quot;h&quot;, 3, Time) will add 3 hrs to the current time.

indicating a negative number will subtract from the time...

Text1 = DateAdd(&quot;h&quot;, -3, Time) will subtract 3 hrs from the current time.





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top