1.20.x date.inc date_week_days_ordered($weekdays)

Reorders weekdays to match the first day of the week.

Parameters

array $weekdays: An array of weekdays.

Return value

array: An array of weekdays reordered to match the first day of the week.

File

includes/date.inc, line 232
Date API functions and constants.

Code

function date_week_days_ordered($weekdays) {
  $first_day = config_get('system.date', 'first_day');
  if ($first_day > 0) {
    for ($i = 1; $i <= $first_day; $i++) {
      $last = array_shift($weekdays);
      array_push($weekdays, $last);
    }
  }
  return $weekdays;
}