|
- <?php
-
- namespace common\components;
-
- class Date
- {
- public static function getDaysOfWeekArray(string $lang = 'fr'): array
- {
- if($lang == 'fr') {
- return [
- 1 => 'Lundi',
- 2 => 'Mardi',
- 3 => 'Mercredi',
- 4 => 'Jeudi',
- 5 => 'Vendredi',
- 6 => 'Samedi',
- 7 => 'Dimanche'
- ];
- }
- else {
- return [
- 1 => 'Monday',
- 2 => 'Tuesday',
- 3 => 'Wednesday',
- 4 => 'Thursday',
- 5 => 'Friday',
- 6 => 'Saturday',
- 7 => 'Sunday'
- ];
- }
- }
-
- public static function getDayOfWeekStringByNumber(int $dayOfWeekNumber, string $lang = 'fr'): string
- {
- $daysOfWeekArray = self::getDaysOfWeekArray($lang);
- return $daysOfWeekArray[$dayOfWeekNumber];
- }
- }
|