Question

I am planing to make a scheduling application. According to the business logic the first day of the week starts from the moment you finish your vacation..For Example: If my vacation ended years and I would start my work from today..It would be counted as my 1st week at work but actually according to the calender its the 25.I would be again eligible for a vacation on week 40 but not from the actual calender but from the system that is calculating my weeks from the last time i Came back from one. I need some help on how to calculate it and how it works when the new years week is 1.

Can some one please suggest me a solution. Thanks.

Was it helpful?

Solution 2

 int weeks=0;
  DateTime firstdayback = Convert.ToDateTime ("2013-06-01");
            weeks = DateTime.Now.Subtract(firstdayback).Days / 7;
            Console.WriteLine(weeks);

Persistence Pays B*s !

OTHER TIPS

You can use the class Week of the Time Period Library for .NET which supports various week calculations:

TimeCalendar calendar = new TimeCalendar(
    new TimeCalendarConfig { YearWeekType = YearWeekType.Iso8601 } );
Week week = new Week( new DateTime( 2012, 01, 01 ), calendar );
Console.WriteLine( "week #: ", week.WeekOfYear );
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top