-5

I want to start my week from Saturday. Friday will be weekend. In that case, I will provide current date and need to get the last date of current week.

Suvro
  • 352
  • 2
  • 13
  • Check this http://stackoverflow.com/questions/2821035/c-sharp-get-start-date-and-last-date-based-on-current-date – Aliasgar Rajpiplawala Dec 17 '15 at 06:53
  • So you mean you want "Today (if today is Friday) and the next Friday otherwise"? Okay, that seems reasonably clear - although you need to define what "today" means in terms of time zones. So have you tried *anything* yet? The simplest approach would be to just use a loop, adding a day repeatedly until you hit Friday... And what does this have to do with Windows Forms? – Jon Skeet Dec 17 '15 at 06:54
  • Have you tried anything? Some simple calculation using methods of `DateTime` class will do the job. – Andrey Korneyev Dec 17 '15 at 06:54

1 Answers1

1
var today = DateTime.Now;
var nextFriday = today.AddDays(DayOfWeek.Friday -  today.DayOfWeek).Date;

You can get the next friday which is the last day of the week as in your question

Kien Chu
  • 4,735
  • 1
  • 17
  • 31