So given a datetime
object, I want to get week of year from it with CalendarWeekRule
is FirstDay
and DayOfWeek
is Monday.
In C# i can achieve this with:
int week = DateTimeFormatInfo.InvariantInfo.Calendar.GetWeekOfYear(DateTime, CalendarWeekRule.FirstDay, DayOfWeek.Monday);
And in python I have tried to achieve it with:
myDate.isocalendar()[1]
And
myDate.strftime("%V")
But I am unable to get correct week no for some dates like for:
1) 2015-01-01T00:00:00.000+0000
- C# UsageWeek:
01
- Python UsageWeek:
01
So it is right.
but for:
2) 2016-01-01T00:00:00.000+0000
- C# UsageWeek:
01
- Python UsageWeek:
53
This is wrong.