Get total number of weeks in current year

Dear forum members,

I want to calculate total number of weeks in a current year.

For example : in 2021 , var returns total weeks = 52.

Can anyone help ?
Regards,
Sahil

eg. for US Calendar:
CultureInfo.CreateSpecificCulture(“en-US”).Calendar.GetWeekOfYear(new Datetime(now.Year,12,31), CalendarWeekRule.FirstFullWeek,DayOfWeek.Monday)

grafik

Ensure System.Globalization is imported

also have a look on the dufferent parameters WeekRule etc:

Thanx buddy, it worked

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.