0
I have the following code that is working perfectly, but I need the results within the $arrayDiasSemestre
are '1' to the Monday, '2' to the Tuesday and so on...
$inicio = new DateTime($start_date);
$fim = new DateTime($end_date);
$fim->modify('+1 day');
$interval = new DateInterval('P1D');
$periodo = new DatePeriod($inicio, $interval ,$fim);
foreach($periodo as $data){
$arrayDiasSemestre[] = $data->format("l");
}
How could I change this entry at the time of filling in the array? Would anyone know any way to do that?
He wants the returns with the days of the week instead of the days of the month? That’s it?
– Erlon Charles
@Erloncharles I think so, instead of the name of the day of the week.
– Sergio
This question would not solve?
– Erlon Charles
@Erloncharles I think this question is the inverse of the one you put on the link. Ie the AP wants a number.
– Sergio
Hummm, ok, now I understand what he needs. He wants the day of the month for a day of the week on a date. Is that it, or does he just want the number that represents the day of the week? Or the number that represents the order of the date in the range?
– Erlon Charles
We’ll know soon enough :)
– Sergio
That’s right, my friends! Barbada, I didn’t know I had 'w' in this role too... Only he uses 0 for Monday and so on and I use 1 for Monday... But I’m going to change in the comic book and leave it like this you’re going to marry right!
– Alceu
@Erloncharles seems to have read it correctly :) I will delete the comments here, if you can/want to delete them too.
– Sergio