-4
\$\begingroup\$

I have an application where a user will give input Start Date, End Date and Series End Date. Example StartDate= 02/12/2019

EndDate = 03/16/2019

SeriesEndDate= 12/31/2025

I want to get start and end date of every week in a result set for all the period within the Series End Date. My question is similar to the one found here https://stackoverflow.com/questions/28191498/get-every-weeks-start-and-end-date-from-listdatetime-using-linq. But I want the weeks to end within the Series Date End that the user supply. I am trying to reuse the code from the link above. Any help will be appreciated

var dating22 = (from d in dates
           where d.DayOfWeek == DayOfWeek.Monday
           select new 
           { 
             StartWeekDate = d.DayOfWeek != DayOfWeek.Monday ? d.Date.PreviousOfWeek(DayOfWeek.Monday) : d.Date, 
             EndWeekDate = d.NextDayOfWeek(DayOfWeek.Sunday) 
           }).Distinct();
New contributor
user2061998 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
\$\endgroup\$

closed as off-topic by 200_success, vnp, Sᴀᴍ Onᴇᴌᴀ, Jamal Feb 11 at 6:36

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – 200_success, vnp, Sᴀᴍ Onᴇᴌᴀ, Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.