Link to home
Start Free TrialLog in
Avatar of beridius
beridius

asked on

mysql date format

is they away to convert the date format from yyyy-mm-dd to dd-mm-yyyy
ASKER CERTIFIED SOLUTION
Avatar of pilson66
pilson66
Flag of Ukraine image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you mean to change your database and revise all the values in it, I strongly recommend against that.  There are a lot of reasons to keep the standard MySQL format.

If you mean to change the format as you select a date, try this:

SELECT DATE_FORMAT(YourDateField, "%d-%m-%Y) FROM Yourtable WHERE .....
mysql> SELECT DATE_FORMAT('2009-10-04 22:23:00', '%d %m %Y');
+------------------------------------------------+
| DATE_FORMAT('2009-10-04 22:23:00', '%d %m %Y') |
+------------------------------------------------+
| 04 10 2009                                     | 
+------------------------------------------------+
1 row in set (0.00 sec)

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
mysql> SELECT DATE_FORMAT('2009-10-04', '%d-%m-%Y');
+---------------------------------------+
| DATE_FORMAT('2009-10-04', '%d-%m-%Y') |
+---------------------------------------+
| 04-10-2009                            | 
+---------------------------------------+
1 row in set (0.00 sec)

Open in new window

Avatar of beridius
beridius

ASKER

when I update the date from a variable  would I use  
UPDATE DATE_FORMAT(YourDateField, "%d-%m-%Y") FROM Yourtable WHERE

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial