Is there any way to format a date mask within a table?

Asked

Viewed 36 times

-3

In case the information is pulled from a database and do not want to put it inside an input. Is there any way?

<td id="outra_data"><?php echo utf8_encode($dados['data_aprovacao']);?></td>
  • 2

    You can [Edit] the post at any time by giving more details about the original data format, the reason for using a character conversion function, the intended result and what did not come out as expected in your attempt (providing a [mcve] of the problem). The way it is. has many unknowns in doubt that can affect the outcome.

  • ????? What??????

1 answer

0


You can use the date function echo date('d/m/Y', $dados['data_aprovacao']);

  • The bank information is in the American standard, this function reverts to the BR standard? Grateful for the response!

  • @Emiliosaymon exactly! running do not forget to validate the answer, grateful!

  • Something is making the mistake " A non well Formed Numeric value encountered in" and "Warning: date() expects Parameter 2 to be long, string Given in" below my code: <pre> <td><? php echo date("d-m-Y", $data['ped_data_issuance']);? ></td> <td><? php echo utf8_encode($data['status_name']);? ></td> <td><? php echo date("d-m-Y",$data['data_approval']);? ></td> </pre>

  • Test one date at a time. Check that your fields come from the database in date format. You can also encode the dates, like this: $dtemissao = strtotime($data['ped_data_emissao']); echo date("d-m-Y", $dtemissao);

  • I’ll test it this way, thank you very much.

  • Thank you very much friend worked out first THANKS!!!! Eternally grateful! Abs!

Show 1 more comment

Browser other questions tagged

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