Week of Year C# Datetime

后端 未结 6 934
情深已故
情深已故 2020-12-20 15:37

I have following code to get the weeknumber of the year given in the DateTime object Time

    public static int WeeksInYear(DateTime date)
    {
        Grego         


        
6条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-20 15:56

    The algorithm is doing exactly what you have instructed it to do. You have the CalanderWeekRule set to FirstFourDayWeek. The 1st of January 2012 was not part of the first four day week, so you have instructed the calander to start counting from January 2nd.

    Calculate date from week number

提交回复
热议问题