This is a discussion on Changing date format within the MySQL Database forums, part of the Database Forums category; Hi, I have a MySql database table USERS with about a 1000 records. I have a field called Date_joined where ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
I have a MySql database table USERS with about a 1000 records. I have a field called Date_joined where the date is stored in the format like Fri Feb 24 10:03:46 PST 2006. How can I convert this date format to 02/24/2006? Is there any query that would convert this field for all the records? |
|
|||
|
Hi,
Just check out the following link: ( self explanatory ) http://dev.mysql.com/doc/refman/5.1/...functions.html Read about the 2 functions you need: STR_TO_DATE(str,format) AND DATE_FORMAT() They do the magic (for your case you need the first one only) Hope it helps. Cheers, Dragomir Stanchev ------------------------- mohammed.naghman@gmail.com wrote: > Hi, > > I have a MySql database table USERS with about a 1000 records. > > I have a field called Date_joined where the date is stored in the > format like Fri Feb 24 10:03:46 PST 2006. > > How can I convert this date format to 02/24/2006? > > Is there any query that would convert this field for all the records? |
|
|||
|
The|Godfather wrote: > Hi, > > Just check out the following link: ( self explanatory ) > http://dev.mysql.com/doc/refman/5.1/...functions.html > > Read about the 2 functions you need: > > STR_TO_DATE(str,format) > > AND > > DATE_FORMAT() > > They do the magic (for your case you need the first one only) > Hope it helps. > > Cheers, > Dragomir Stanchev > > ------------------------- > mohammed.naghman@gmail.com wrote: > > Hi, > > > > I have a MySql database table USERS with about a 1000 records. > > > > I have a field called Date_joined where the date is stored in the > > format like Fri Feb 24 10:03:46 PST 2006. > > > > How can I convert this date format to 02/24/2006? > > > > Is there any query that would convert this field for all the records? Consider storing the date in the mysql datetime format (YYYY-MM-DD HH:MM:SS) and then displaying it in whatever format you like when you retrieve it. |