Determine Next/Previous Weekday

Determine Next/Previous Weekday

This function returns week identifier information, such as Week Beginning/Ending date, and makes it more generic to return a date of any previous or following weekday. You can use this function in VB5 and VBA5; with minor modifications to the optional arguments, you can also use it in VB3 and VB4:

 Public Function SpecificWeekday(d As Date, _	Optional ByVal WhatDay As Byte = _	vbSaturday, Optional ByVal GetNext _	As Boolean = True) As Date	'Purpose: Returns a date of the 	'Next/Previous specific weekday for a given date	' Input:		d - Date for which next/previous 	'			weekday is needed 	'			WhatDay - optional (byte) 	'			argument (default = vbSaturday)	'			specifying what weekday to find	'			GetNext - optional (Boolean) 	'			argument: True for 	'			Next(default), False for Previous	'Output:		Date of the next/previous specific weekday	'Note:		If both optional arguments are 	'			omitted, returns Week-Ending Date	'			If passed date (d) falls on the 	'			same weekday as WhatDay, the 	'			function returns the passed date 	'			unchanged.	Dim iAdd As Integer	iAdd = (WhatDay - WeekDay(d))	If GetNext Then		SpecificWeekday = DateAdd("d", IIf(_			iAdd >= 0, iAdd, 7 + iAdd), d)	Else		SpecificWeekday = DateAdd("d", IIf(_			iAdd <= 0, iAdd, iAdd - 7), d)	End IfEnd Function
Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes