From: Martin Gainty Date: April 9 2010 3:04pm Subject: DATE_FORMAT parameter question List-Archive: http://lists.mysql.com/mysql/221191 Message-Id: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="_2654a557-d8bf-43dd-b3c0-abbe8e0e63d3_" --_2654a557-d8bf-43dd-b3c0-abbe8e0e63d3_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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 =20 mysql> select DATE_FORMAT('11-10-09'=2C'%y-%b-%d') from DUAL=3B +------------------------------------+ | DATE_FORMAT('11-10-09'=2C'%y-%b-%d') | +------------------------------------+ | 11-Oct-09 | +------------------------------------+ 1 row in set (0.00 sec) =20 mysql> show variables like "%VERSION%"=3B +-------------------------+------------------------------+ | 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 an= d %y is year i see: mysql> select DATE_FORMAT('11-10-09'=2C'%d-%b-%y') from DUAL=3B +------------------------------------+ | DATE_FORMAT('11-10-09'=2C'%d-%b-%y') | +------------------------------------+ | 09-Oct-11 | =20 but if i switch %y and %d in date_format I get the correct result e.g. mysql> select DATE_FORMAT('11-10-09'=2C'%y-%b-%d') from DUAL=3B +------------------------------------+ | DATE_FORMAT('11-10-09'=2C'%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? =20 Many Thanks=2C Martin Gainty=20 ______________________________________________=20 Verzicht und Vertraulichkeitanmerkung/Note de d=E9ni et de confidentialit= =E9 Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaeng= er sein=2C so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiter= leitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient l= ediglich dem Austausch von Informationen und entfaltet keine rechtliche Bin= dungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen w= ir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut =EAtre privil=E9gi=E9. Si vous n'=EAtes= pas le destinataire pr=E9vu=2C nous te demandons avec bont=E9 que pour sat= isfaire informez l'exp=E9diteur. N'importe quelle diffusion non autoris=E9e= ou la copie de ceci est interdite. Ce message sert =E0 l'information seule= ment et n'aura pas n'importe quel effet l=E9galement obligatoire. =C9tant d= onn=E9 que les email peuvent facilement =EAtre sujets =E0 la manipulation= =2C nous ne pouvons accepter aucune responsabilit=E9 pour le contenu fourni= . =20 _________________________________________________________________ Hotmail is redefining busy with tools for the New Busy. Get more from your = inbox. http://www.windowslive.com/campaign/thenewbusy?ocid=3DPID28326::T:WLMTAGL:O= N:WL:en-US:WM_HMP:042010_2= --_2654a557-d8bf-43dd-b3c0-abbe8e0e63d3_--