Solved

How to know Next specified Day?

Posted on 2004-10-07
6
151 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 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 69

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now