0

hello,..

I want to know how to show date on Sunday, for example, I entered into by date
In other words I chose on Sunday, for example, for a period of one month from the start date I entered into
For example, when I say on Sunday from the beginning of Day 1 in August for a month
After that displays all the dates on Sunday in the period

please help me
thank for all you,..

3
Contributors
8
Replies
9
Views
5 Years
Discussion Span
Last Post by adam_k
0

Use DayOfWeek in your start date (has to be datetime).

dim start_date as new datetime(2011,07,30)
msgbox( start_date.dayofweek)

You'll get an integer back showing what day is your start date (1= Monday, 2= Tuesday, ... 7 = Sunday)

Add to your start date the result of 7 - start_date.dayofweek and you'll get the first Sunday after the start date. Keep adding 7 days to that date to get all the Sundays.
Remeber to stop when the date you are currently processing is greater than your end date.

0

ok but how i can show it
and i want to set it manualy it means i want to show sunday date
from 1/07/2011 to 20/08/2011
how i can inter and show it

0

Where do you want to show it? On a DataGrid? On a listview ? On a textbox with commas between each date ?
You have to decide for yourself, build it and let us know if you are having problems.

PS: I believe it would be easier to show the dates on a listview.

0

i want to show it in dbgrid
can you tell me how to do it with set it manual y as i say
please help

0

dbgrid?
Can you tell a more please? Why you are all so shy?
Dont expect any help with this kind of manner guys.

0

Mitja is right, you need to share your code.
Even if you don't know how to show the result in a datagrid, you must try.

To give you a hint, use a while loop that checks that the date you are currently processing + 7 days is not bigger than your end date. If it is not change the date to the new value and add a record to your datagrid.

0

look adam i just want to know
in these code you wrote it

VB.NET Syntax (Toggle Plain Text)
dim start_date as new datetime(2011,07,30)
msgbox( start_date.dayofweek)

why you wrote the date (30,07,2011)
i want to chose or write it manual and show the date of day which i chose in datagrid or anay thing
now you under stand me

0

The code I wrote was just a demonstration on how to use the dayofweek.

I needed a date to use dayofweek and since the day I posted that was July 30th, I've used that date.
Just make sure that you are using dayofweek with a datetime var and assign your datetime any date you like.

PS: Any progress so far?

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.