Help to import SQL data and use on date

Asked

Viewed 21 times

-1

The title is very confused but I don’t know what I want to do.

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

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

So far so good, appears the various dates in the table. Now I need to use the value that comes from the date to use another code ex:

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

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

// Tabela

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

I’m sorry I’m so confused, but I can’t explain it better and I don’t have the full code here.

inserir a descrição da imagem aqui

  • Welcome Vitor! My dear colleague, you said you don’t know what you want to do, you can’t explain and you don’t have the code! If you don’t even know and own anything, imagine us? rs Better needs the question, if it is not impossible to help something that not even you know how to pass us.

  • Without information I know it’s hard.

  • Thanks I’ll try to put here a printscren

  • Vitor, not for nothing, but no way to walk around with your question like that. If I continue to help I will be approving the "bad quality" and this is wrong. I ask you to read at least the How to create a Minimum, Complete and Verifiable example. So we can continue.

  • If you have the code, simply copy and paste here, it was even easier than taking a picture! Besides being running over everything. It is no use taking a code and changing it without at least understanding what it does. It is complicated for both. Here we help with doubts, not making codes. I hope you understand what I mean...

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

PHP Day of the Week

Browser other questions tagged

You are not signed in. Login or sign up in order to post.