Conversion from Date ("yyyy/mm/dd") to ("dd/mm/yyyy")

Asked

Viewed 121 times

0

I’m using a field of sorts Date in the archive HTML, to facilitate the selection of the date, but it will be saved to the bank in American format yyyy/mm/dd, I did the following query to transform this data and show in a dd/mm/yyyy , but it didn’t work:

$seleciona= mysqli_query($conexao,"
    SELECT TO_Char(r.Data,'dd/mm/yyyy'),r.CodReuniao Datas
    FROM reuniao r
    group by TO_Char(r.Data,'dd/mm/yyyy')
    order by Datas ASC"
);

Have some syntax error?

  • Has syntax error yes. TO_CHAR is Oracle (and maybe some other SGBD). Mysql does not work like this. Maybe DATE_FORMAT interest you

  • Voce knows any possible solution?

  • See the yellow frame links above, and the DATE_FORMAT function in the Mysql manual

  • https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format

No answers

Browser other questions tagged

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