?
Solved

How to know Next specified Day?

Posted on 2004-10-07
6
Medium Priority
?
160 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 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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…
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.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

719 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