October 7, 2000

BusinessDateDiff – Evaluate the number of business days between two dates

‘ Evaluate the number of business days between two dates” Note that it doesn’t take Christmas, Easter and’ other holidays into accountFunction BusinessDateDiff(ByVal StartDate As Date, ByVal EndDate As Date, _ Optional ByVal SaturdayIsHoliday As Boolean = True) As Long Dim incr As Date ‘ ensure we don’t take time

High-precision timing with the QueryPerformanceCounter API function

While VB Timer functions is sufficiently precise for most tasks, it doesn’t provide the highest possible resolution most modern computer can provide. If your hardware supports high-resolution counters, you can do a much better job with a pair of API functions: Private Type LARGE_INTEGER lowpart As Long highpart As LongEnd

Create a system timer using AddressOf and a callback function

The Timer control is great when you want to periodically execute a piece of code while the program is doing something else. However, it also has a couple of shortcomings: (1) it requires a parent form, so you can’t use it directly inside a BAS module, and (2) it’s Interval

Retrieve Time Zone information

The GetTimeZoneInformation API returns a TIME_ZONE_INFORMATION variable that contains several pieces of information about system’s time date and time setting. The first Long value in this structure holds the “distance” (in minutes) from Greenwich standard time, so it’s quite easy to create a GetTimeZone function that returns an Integer corresponding

BusinessDateAdd – Add or subtract a number of business days from a date

‘ add or subtract a number of business days from a date” Note that it doesn’t take Christmas, Easter and’ other holidays into accountFunction BusinessDateAdd(ByVal days As Long, ByVal StartDate As Date, _ Optional ByVal SaturdayIsHoliday As Boolean = True) As Date Do While days ‘ increment or decrement the