Re: Changing date result automatically
Dates are not internally stored as a specific region format, they're stored as seconds since epoch - just a big number. Output formatting is a presentation layer issue, which you can solve either in your SQL [select date_format(datefield, 'us format string') from table] or in your application. Maybe MySQL looks at the system's locale for default formatting, or there's a config setting, but I've never looked at that - doing it explicitly protects you from annoying glitches when you move to another system that might be configured slightly differently. On Thu, May 6, 2010 at 11:00 PM, Weydson Lima weys...@gmail.com wrote: I was referring to the function: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format --- Weydson Lima weys...@gmail.com On Thu, May 6, 2010 at 1:58 PM, Martin Gainty mgai...@hotmail.com wrote: http://lists.mysql.com/commits/60834 date_format system variable is currently an unused system variable 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. From: weys...@gmail.com Date: Thu, 6 May 2010 11:44:37 -0500 Subject: Changing date result automatically To: mysql@lists.mysql.com Hi, Is there any way to format all dates generated by a MySQL query as US format? What I want to do is having a generic way to use the DATE_FORMAT function on all my date fields, instead of having to enter them manually. Thank you --- Weydson Lima weys...@gmail.com http://bluetoothmono.weydson.com -- The New Busy is not the old busy. Search, chat and e-mail from your inbox. Get started. http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3 -- Bier met grenadyn Is als mosterd by den wyn Sy die't drinkt, is eene kwezel Hy die't drinkt, is ras een ezel
Re: Re: Changing date result automatically
Thank you for your explanation. I was just curious if there was an easy way to format the output of the dates.. maybe by using a wildcard expression on the field names :) Weydson Lima On May 7, 2010 3:08am, Johan De Meersman vegiv...@tuxera.be wrote: Dates are not internally stored as a specific region format, they're stored as seconds since epoch - just a big number. Output formatting is a presentation layer issue, which you can solve either in your SQL [select date_format(datefield, 'us format string') from table] or in your application. Maybe MySQL looks at the system's locale for default formatting, or there's a config setting, but I've never looked at that - doing it explicitly protects you from annoying glitches when you move to another system that might be configured slightly differently. On Thu, May 6, 2010 at 11:00 PM, Weydson Lima weys...@gmail.com wrote: I was referring to the function: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format --- Weydson Lima weys...@gmail.com On Thu, May 6, 2010 at 1:58 PM, Martin Gainty mgai...@hotmail.com wrote: http://lists.mysql.com/commits/60834 date_format system variable is currently an unused system variable 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. From: weys...@gmail.com Date: Thu, 6 May 2010 11:44:37 -0500 Subject: Changing date result automatically To: mysql@lists.mysql.com Hi, Is there any way to format all dates generated by a MySQL query as US format? What I want to do is having a generic way to use the DATE_FORMAT function on all my date fields, instead of having to enter them manually. Thank you --- Weydson Lima weys...@gmail.com http://bluetoothmono.weydson.com -- The New Busy is not the old busy. Search, chat and e-mail from your inbox. Get started.http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3 -- Bier met grenadyn Is als mosterd by den wyn Sy die't drinkt, is eene kwezel Hy die't drinkt, is ras een ezel
Re: Changing date result automatically
You build pretty much any format you desire out of those speifiers. ie: select date_format(now(),'%m/%c/%Y'); - md On Thu, May 6, 2010 at 5:00 PM, Weydson Lima weys...@gmail.com wrote: I was referring to the function: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format --- Weydson Lima weys...@gmail.com On Thu, May 6, 2010 at 1:58 PM, Martin Gainty mgai...@hotmail.com wrote: http://lists.mysql.com/commits/60834 date_format system variable is currently an unused system variable 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. From: weys...@gmail.com Date: Thu, 6 May 2010 11:44:37 -0500 Subject: Changing date result automatically To: mysql@lists.mysql.com Hi, Is there any way to format all dates generated by a MySQL query as US format? What I want to do is having a generic way to use the DATE_FORMAT function on all my date fields, instead of having to enter them manually. Thank you --- Weydson Lima weys...@gmail.com http://bluetoothmono.weydson.com -- The New Busy is not the old busy. Search, chat and e-mail from your inbox. Get started.http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3 -- - michael dykman - mdyk...@gmail.com May the Source be with you. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: Changing date result automatically
I was referring to the function: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format --- Weydson Lima weys...@gmail.com On Thu, May 6, 2010 at 1:58 PM, Martin Gainty mgai...@hotmail.com wrote: http://lists.mysql.com/commits/60834 date_format system variable is currently an unused system variable 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. From: weys...@gmail.com Date: Thu, 6 May 2010 11:44:37 -0500 Subject: Changing date result automatically To: mysql@lists.mysql.com Hi, Is there any way to format all dates generated by a MySQL query as US format? What I want to do is having a generic way to use the DATE_FORMAT function on all my date fields, instead of having to enter them manually. Thank you --- Weydson Lima weys...@gmail.com http://bluetoothmono.weydson.com -- The New Busy is not the old busy. Search, chat and e-mail from your inbox. Get started.http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3