Good Afternoon All

following the documentation available at

http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html

i wish to select a date using DD-MON-YY format but my format of '%y-%b-%d' 
appears to be incorrect

 

mysql> select DATE_FORMAT('11-10-09','%y-%b-%d') from DUAL;
+------------------------------------+
| DATE_FORMAT('11-10-09','%y-%b-%d') |
+------------------------------------+
| 11-Oct-09                          |
+------------------------------------+
1 row in set (0.00 sec)

 

mysql> show variables like "%VERSION%";
+-------------------------+------------------------------+
| Variable_name           | Value                        |
+-------------------------+------------------------------+
| protocol_version        | 10                           |
| version                 | 5.1.25-rc-community-log      |
| version_comment         | MySQL Community Server (GPL) |
| version_compile_machine | ia32                         |
| version_compile_os      | Win32                        |
+-------------------------+------------------------------+
5 rows in set (0.00 sec)


it seems when i follow the documentation which states %d is used for day and %y 
is year i see:
mysql> select DATE_FORMAT('11-10-09','%d-%b-%y') from DUAL;
+------------------------------------+
| DATE_FORMAT('11-10-09','%d-%b-%y') |
+------------------------------------+
| 09-Oct-11                          |

 

but if i switch %y and %d in date_format I get the correct result e.g.

mysql> select DATE_FORMAT('11-10-09','%y-%b-%d') from DUAL;
+------------------------------------+
| DATE_FORMAT('11-10-09','%y-%b-%d') |
+------------------------------------+
| 11-Oct-09                          |
+------------------------------------+
1 row in set (0.00 sec)


any ideas on what I am doing wrong with format string to produce desired 
DD-MON-YY format?

 

Many Thanks,
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.


                                          
_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your 
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

Reply via email to