I have a VB program that needs to count number of events between two datetime values.

Something like this:

SELECT COUNT(*) FROM Report WHERE WeigthTime BETWEEN "Time1" AND "Time2"

Time1 is now. I get it with "SELECT GETDATE()"

I need to calculate Time2 by decrementing it for X hours. X is insertred in VB Form.

Is there some operators for datetime format?

Please help.
Best regards

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.