Welcome Guest, Not a member yet? Register   Sign In
how to change date format
#1

[eluser]Unknown[/eluser]
i have tabel in mysql databases in coloum date already set date like 2005/05/01 ( year/month/date) can you help me . i'd like to change date/month/year
#2

[eluser]Tominator[/eluser]
No way man! Big Grin

Really you can't change how it's stored, but you can't change how it will be dumped via DATE_FORMAT() function.
#3

[eluser]jrtashjian[/eluser]
I normally store dates as a timestamp in the database and use PHP's date() to format it. Makes everything easier. I know you can use DATE_FORMAT() to format it directly in MySQL however, I'm pretty sure you can only store dates using the "-" separator not the "/". Which tells me you're most likely storing the date in a varchar() column and not a date() column.
#4

[eluser]Tominator[/eluser]
Use DATE_FORMAT() - it's faster:
http://www.onextrapixel.com/2010/06/23/m...rformance/
#5

[eluser]danmontgomery[/eluser]
[quote author="jrtashjian" date="1288637854"]Which tells me you're most likely storing the date in a varchar() column and not a date() column.[/quote]

This. Mysql's date format is Y-m-d. You can't perform Mysql's native date functions unless the column is a date type (date, datetime, timestamp)... It will also accept YYYYMMDD, but not MM/DD/YYYY




Theme © iAndrew 2016 - Forum software by © MyBB