Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to know Next specified Day?

Posted on 2004-10-07
6
Medium Priority
?
162 Views
Last Modified: 2010-04-23
Hello,

Is it possible to know for exemple the next sunday if the startDate is now.
Or the second monday of the next month...

So possibilities is First, second, third, fourth or last dayofweek of a specified month.

Thank for your help!!
0
Comment
Question by:ocadieux
  • 2
6 Comments
 
LVL 8

Accepted Solution

by:
bramsquad earned 500 total points
ID: 12250562
this will give you the weekending date (saturday's date) of whatever week your startDate is in

        Dim WeekEnding As Date = DateAdd(DateInterval.Day, (7 - DatePart(DateInterval.Weekday, startDate)), CDate _
                                                (Mid(CStr(startDate), 1, 10)))

so just changing the '7' to an '8', you can get the sunday of next week

        Dim WeekEnding As Date = DateAdd(DateInterval.Day, (8 - DatePart(DateInterval.Weekday, startDate)), CDate _
                                                (Mid(CStr(startDate), 1, 10)))

the rest of what your asking is simply a manipulation of these functions.  

~b

0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 12250963
0
 
LVL 8

Expert Comment

by:bramsquad
ID: 12533281
i feel the question was answered.

also my comment in this thread was made before emoreau's comment in his similar thread (to avoid the case of plagerism)....i think thats how you spell it  :)

~b
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question