15,035,723 members
See more:
Hi All,

I want to get first and last dates of week by providing one date. This date may be of any day of the week. Is there any way to get the last and first days of particular that week? X|
Posted

## Solution 1

Have you considered reading the documentation for the DateTime class, or even using intellisense to look at the methods it offers ?
jisha Johnson 5-Jul-10 6:28am

I've got the methods like getting day of week and all. Bt I want to get that particular week's first day and last day? I cant get anything like that. I've searched many places. Bt I haven't got an answer. If u can give me any link to the doc.
Christian Graus 5-Jul-10 6:37am

Notwithstanding that Abhishek points out an issue that did not occur to me ( knowing if the first day is considered Mon or Sun ), getting the first day of the week, is basic maths. If you're on day 4, the first day, is four days ago ( because I believe it's 0 indexed ).

## Solution 2

You can get the day of the week using this link.
Based on this date and day, you should easily be able to get the first and last dates of the week by writing some of your own code logic.
jisha Johnson 5-Jul-10 7:42am

Thank u.This was informative

## Solution 3

I think this is what you wanted for :

```public DateTime GetFirstDate(DateTime thisDate)
{
DayOfWeek currentfdayname = cinfo.DateTimeFormat.FirstDayOfWeek;
DayOfWeek currenttdayname = cinfo.Calendar.GetDayOfWeek(DateTime.Now);

int diff = currenttdayname - currentfdayname;

return firstDate;
}
```

jisha Johnson 5-Jul-10 7:41am

With some changes this was my answer. Thank u