Help to import SQL data and use on date

-1

The title is very mixed but I do not know what I want to do.

Within a table with data coming from the database I have the following structure:

echo '<tr><td> '.$row["data"].'</td></tr>';

So far so good, the various dates appear in the table. Now I need to use the value coming from the date to use another code eg:

$dataextenco = '.$row["data"].';

// Transformar a data que vem do BD em dia da semana

// Tabela

echo '<tr><td> '.$row["data"].'</td></tr>';

Sorry for being too cluttered, but I can not explain it better and I do not have the complete code here.

    
asked by anonymous 11.09.2018 / 12:14

1 answer

0

Printing the day of the week:

 // Array com os dias da semana
 $diasemana = array('Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sabado');

 // Aqui define a data no formato Ano-mês-dia (2018-09-11)
 $data = $row["data"];

 // Varivel que recebe o dia da semana (0 = Domingo, 1 = Segunda ...)
 $diasemana_numero = date('w', strtotime($data));

 // Exibe o dia da semana
 echo $diasemana[$diasemana_numero];

Reference

Day of the Week in PHP

    
11.09.2018 / 12:30