You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 line
791B

  1. <?php
  2. namespace common\components;
  3. class Date
  4. {
  5. public static function getDaysOfWeekArray(bool $withNullValue = false): array
  6. {
  7. $daysOfWeekArray = [];
  8. if($withNullValue) {
  9. $daysOfWeekArray[null] = '--';
  10. }
  11. $daysOfWeekArray = $daysOfWeekArray +
  12. [
  13. 1 => 'Lundi',
  14. 2 => 'Mardi',
  15. 3 => 'Mercredi',
  16. 4 => 'Jeudi',
  17. 5 => 'Vendredi',
  18. 6 => 'Samedi',
  19. 7 => 'Dimanche'
  20. ];
  21. return $daysOfWeekArray;
  22. }
  23. public static function getDayOfWeekStringByNumber(int $dayOfWeekNumber): string
  24. {
  25. $daysOfWeekArray = self::getDaysOfWeekArray();
  26. return $daysOfWeekArray[$dayOfWeekNumber];
  27. }
  28. }