Solved

How to know Next specified Day?

Posted on 2004-10-07
6
155 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 8

Accepted Solution

by:
bramsquad earned 125 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

751 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