Function

GLibDateget_weeks_in_year

unstable since: 2.86

Declaration [src]

guint8
g_date_get_weeks_in_year (
  GDateYear year,
  GDateWeekday first_day_of_week
)

Description [src]

Calculates the number of weeks in the year.

The result depends on which day is considered the first day of the week, which varies by locale. first_day_of_week must be valid.

The result will be either 52 or 53. Years always have 52 seven-day periods, plus one or two extra days depending on whether it’s a leap year. This function effectively calculates how many first_day_of_week days there are in the year.

Available since: 2.86

Parameters

year

Type: GDateYear

Year to count weeks in.

first_day_of_week

Type: GDateWeekday

The day which is considered the first day of the week (for example, this would be G_DATE_SUNDAY in US locales, G_DATE_MONDAY in British locales, and G_DATE_SATURDAY in Egyptian locales.

Return value

Type: guint8

The number of weeks in year.