Get Date

  • Thread starter Thread starter Ola
  • Start date Start date
O

Ola

How can i get the date if i have weekno, year and
dayofweek using gregorian calender
 
here's a way :

// Sunday is the first day of the week
private DateTime GetDate(int iYear, int iWeekNo, int iDayNo)
{
DateTime dt = new DateTime(iYear, 1, 1);
if (dt.DayOfWeek != DayOfWeek.Sunday)
dt = dt.AddDays(7 - (int)dt.DayOfWeek);
return dt.AddDays(((iWeekNo - 1) * 7) + iDayNo - 1);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top