You are here

function date_week_days_ordered in Date 7.2

Same name and namespace in other branches
  1. 5.2 date_api.module \date_week_days_ordered()
  2. 6.2 date_api.module \date_week_days_ordered()
  3. 6 date_api.module \date_week_days_ordered()
  4. 7.3 date_api/date_api.module \date_week_days_ordered()
  5. 7 date_api/date_api.module \date_week_days_ordered()

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.

1 call to date_week_days_ordered()
DateApiTestCase::testDateApi in date_api/tests/DateApiTestCase.test
Test date_format_date().

File

date_api/date_api.module, line 1341
This module will make the date API available to other modules.

Code

function date_week_days_ordered(array $weekdays) {
  $first_day = variable_get('date_first_day', 0);
  if ($first_day > 0) {
    for ($i = 1; $i <= $first_day; $i++) {
      $last = array_shift($weekdays);
      array_push($weekdays, $last);
    }
  }
  return $weekdays;
}