0
I tried to do it in JS
function diaSemana() {
var data = new Date();
var dia = data.getDay();
var dias = ['Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado'];
var p = document.getElementById('campo').value = dias[dia];
return p;
}
diaSemana();
<p>Estes são os respetivos campos, e queria pegar o valor da data e passar em simultâneo quando escolho um dia para campo de leitura.</p>
<form>
<label>Data:</label>
<input type="date" id="data">
<label>Dia da Semana:</label>
<input type="text" id="campo" readonly>
</form>
function diaSemana() {
var data = new Date();
var dia = data.getDay();
var dias = ['Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado'];
var p = document.getElementById('p').innerHTML = dias[dia];
return p;
}
diaSemana();
I will implement the script, the year and the month will be dynamic with PHP.
– Willeu Manuel
Cool Willeu! Then this script should change a little bit. If there are issues post again, abs ;)
– Marcelo Vismari
All right, Marcelo...
– Willeu Manuel

 const objDate = new Date(ano, mes - 1, dia); 


Wanted a recommendation on how to make this dynamic, tried and failed. I feel that this functionality should be created with JS in contrast to PHP, which I’ve already done, but it doesn’t have the interaction and accessibility that I wanted. I would be grateful, @Marcelovismari– Willeu Manuel
I didn’t understand it very well. The value of
objDate
come from PHP? something like:const objDate = new Date(<%= $ano %>, <%= $mes %>, <%= $dia %>);
?– Marcelo Vismari