473,765 Members | 1,955 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Function to Move (Forwards or Backwards) Through Weekdays

NeoPa
32,572 Recognized Expert Moderator MVP
This code is quite old and may be bettered.
If anyone feels they can produce better code for this function go ahead and PM me your effort. If I feel that it is better (More efficient & 100% accurate) then I will replace this with it.
Until then, it is at least a usable version that visitors can use when they're in need.

Expand|Select|Wrap|Line Numbers
  1. 'MoveWD moves datThis on by the intInc weekdays.
  2. Public Function MoveWD(datThis As Date, intInc As Integer) As Date
  3.     MoveWD = datThis
  4.     For intInc = intInc To Sgn(intInc) Step -Sgn(intInc)
  5.         MoveWD = MoveWD + Sgn(intInc)
  6.         Do While (Weekday(MoveWD) Mod 7) < 2
  7.             MoveWD = MoveWD + Sgn(intInc)
  8.         Loop
  9.     Next intInc
  10. End Function
Jan 21 '07 #1
0 7022

Sign in to post your reply or Sign up for a free account.

Similar topics

2
8056
by: Tiernan | last post by:
Hi all I'm looking for a way to find the number of weekdays between 2 dates In my form I have three fields for a begin date (dd)(mm)(yyyy) and three for the end date (dd)(mm)(yyyy) Now these values will be stored into a database and at the same time there will be an e-mail generated and send to me that contains the starting date en the end date . But now I want an extra line in this e-mail that tells me howmany days there are between the...
10
2691
by: JJA | last post by:
I'm trying to use document.getElementByID inside a function where the ID is passed as an argument. I get the same error ("Element has no properties") on the same statement inside the commonCheck function with either MS IE 6.0 or Mozilla Firefox 0.9. Comments below indicate that if I hardcode an element ID I can avoid the error, but I obviously want to parameterize it. Here are some snippets of my code: -----snippet...
26
2749
by: MLH | last post by:
How would I modify the following to achieve a 2-dimensional array? Dim MyWeek, MyDay MyWeek = Array("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun") ' Return values assume lower bound set to 1 (using Option Base ' statement). MyDay = MyWeek(2) ' MyDay contains "Tue". MyDay = MyWeek(4) ' MyDay contains "Thu". In other words, I want the array to hold
5
2284
by: Daniel Rudy | last post by:
Hello Group, I've looked at this backwards and forwards and I can't seem to find the problem here. What happens is I have a multidimensional array of char that has 3 dimensions with a declaration assignment. After a certian point in the array, I get garbage. Not sure why. Granted this is a little off topic because of what the code does, but I'm hoping that a few extra pairs of eyes can see what I'm missing. #define CRYPTO_KEYMAX ...
4
2007
by: MLH | last post by:
I'm thinking of an integer field in which I could write values up to 1+2+4+8+16+32+64 and to use these values later. Each of the individual values would represent a weekday from Sunday to Saturday. So if I were to look at a record for a newspaper publication and see 9 in the field, I could interpret that as meaning the publication was released on Sundays (1) and Wednesdays (8). A value of 127 would indicate a daily paper publishing...
1
7544
by: anupamaavadutha | last post by:
hi all, iam new to javascript. i have problem calling javascript functions.iam designing a calender page.here is my code. <%@ page import='java.io.*,java.util.*,java.sql.*,javax.servlet.*,javax.servlet.http.*' session='true'%> <%@ page import='java.text.*'%> <html> <script language='javascript'> function backward() { alert("hello"); }
1
2218
by: Orestis Markou | last post by:
Hello, I'm the developer of PySmell ( http://github.com/orestis/pysmell ), a static analysis/intellisense provider for Python. I am targeting Python 2.4 code so I'm using the compiler package. I've been toying around yesterday with the ast module in Python 2.6 and it seems much more cleaner. One thing I don't understand is how should one handle backwards and forwards compatibility.
0
160
by: Terry Reedy | last post by:
Orestis Markou wrote: My impression is that the 2.6 ast package is quite different from the 2.4 compiler package, but I have not looked at it (in its 3.0 version) yet. If the 2.4 code you are analyzing is syntactically and sematically valid as 2.6 code, which I believe is usual, then of course there is no problem. If it is not, then I would not be sure. If you want to target 2.3 to 3.0, 2.6 is the only option as far as I
18
2034
by: MyWaterloo | last post by:
I quickly put this code together to test if it would disable some of my functions OnChange when my text box (purchase order number) is empty...and if it would enable those functions when I added data to my field. The funny thing is that if you read the code it actually runs in reverse! When my field is null it is suppose to disable...instead it enables...Why? So I put my code in to do the opposite of what I want and it works!?!?! I don't mind...
0
9398
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10160
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9951
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9832
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7378
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2805
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.