I took this calendar.

the calendar

And made 2 input with the choice of a range of dates. I have code that makes this range

$d1 = date('d.m', strtotime($_POST["date1"])); $d2 = date('d.m', strtotime($_POST["date2"])); $dates = range($d1,$d2); 

Now I need him to figure out what day it is.

    2 answers 2

     $dayweek = array( "0"=>"Воскресенье" , "1"=>"Понедельник" , "2"=>"Вторник" , "3"=>"Среда" , "4"=>"Четверг" , "5"=>"Пятница" , "6"=>"Суббота" ); echo( $dayweek[date("w", strtotime($_POST["date1"]))]); 

    you can still date ('D');

    But there you need to write a locale, something like

     setlocale ( LC_TIME , 'Russian_Russia.1251' ); 

      In your version it will work if you add below:

       $wdRu = Array('Воскресенье','Понедельник','Вторник','Среда','Четверг','Пятница','Суббота'); for ($i=0;$i<sizeof($dates);$i++) { $weekDay[$i] = date('w',strtotime(str_replace(',','.',$dates[$i]).'.11')); $out .= $wdRu[$weekDay[$i]].' '.$dates[$i].' '; } 

      With this approach, you can use the design

       $wdRu[$weekDay[$i]] 

      to display the Russian name of the day of the week, in your cycle, where you need it, because its iterator will be equal to an iterator in $ dates

      PS: By the way, your approach will only work for this year, since the numbers $ 24.09 are recorded in $ dates; 25.09, etc.

      PPS: look at this topic here Array of dates in PHP