Solved

How to know Next specified Day?

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

617 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