Week of Year C# Datetime

后端 未结 6 936
情深已故
情深已故 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 16:00

    1/1/2012 it was sunday. I believe that's why you get 52, because it was last day of the last year week. For the 2nd of january you should get the right result.

提交回复
热议问题