actualizar formato de fecha

I am unable to update mysql date

trying ,

mysql is remaining 0000-00-00 when inserting date format date('d-m-Y')

gracias

preguntado el 03 de mayo de 12 a las 21:05

1 Respuestas

Use esto en su lugar:

date('Y-m-d')

Also, if you just want to use the current time/date and your MySQL server is in the same timezone as your web server, you can utilizado NOW() en tu SQL preferiblemente.

contestado el 03 de mayo de 12 a las 21:05

Thanks Brad it worked but I want to have this format d-m-Y when I output the date to the table - user1347219

@user1347219, You must use this format when inserting data into your data. If you want to format the data when you output it del the table, then you should do that with PHP: date('d-m-Y', strtotime($your_mysql_date)) Don't store formatted dates in the database. Use datetime or timestamp columns as appropriate, and leave formatting of data up to PHP. - Brad

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.