Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
08-28-2003, 02:31 AM
|
#1
|
Member
Registered: Mar 2003
Location: Macondo
Distribution: Mandrake 9.1, 10.1, SuSE 8.1 pro, 10.1, Red Hat 8.0/9.0
Posts: 380
Rep:
|
Changing date format in MySQL table
Hello All,
I have a Bugzilla installation that uses MySQL DB (of course). The date tables in MySQL currently have the following format:
mm-dd-yyyy
We would like to change it to:
dd/mm/yyyy
Would anybody know a quick hack for this?
|
|
|
08-28-2003, 02:42 AM
|
#2
|
Member
Registered: Aug 2003
Location: Belgium
Distribution: Debian (server), Kubuntu (desktop)
Posts: 248
Rep:
|
You can always change the format in your query like this:
SELECT DATE_FORMAT(thedatetime,'%d/%m/%y %H:%i:%s') FROM ...
I don't know if it's possible to change the format mysql uses by default.
|
|
|
08-28-2003, 02:58 AM
|
#3
|
Member
Registered: Mar 2003
Location: Macondo
Distribution: Mandrake 9.1, 10.1, SuSE 8.1 pro, 10.1, Red Hat 8.0/9.0
Posts: 380
Original Poster
Rep:
|
Does MySQL have a set format or do you set it when you create the table?
By the way, does MySQL have a history file or log file somewhere where I can check the sql statements to see how that table was created?
Last edited by vous; 08-28-2003 at 02:59 AM.
|
|
|
08-28-2003, 03:13 AM
|
#4
|
Member
Registered: Aug 2003
Location: Belgium
Distribution: Debian (server), Kubuntu (desktop)
Posts: 248
Rep:
|
I'm guessing that you can't change the internal MySQL date format because if you do, all the date functions will return wrong results. But I'm not sure about that.
I always create my tables by using a script file so that I still know what I've done later on. If you don't have such a script, you can always do some reverse engineering to generate one. There are several tools to do this, check out http://www.datanamic.com/ to see if they have any tools to help you out.
|
|
|
08-28-2003, 03:19 AM
|
#5
|
Member
Registered: Mar 2003
Location: Macondo
Distribution: Mandrake 9.1, 10.1, SuSE 8.1 pro, 10.1, Red Hat 8.0/9.0
Posts: 380
Original Poster
Rep:
|
On the logging question, I have read in MySQL docs that indeed it does have a query log file, BUT it is not default and you have to flag it on start in order for it to work :-( ...but again any ideas are welcome :-)
On the reverse engineering, even though it sounds cool, we are a bit strapped for time, but if we get an extension I'll definitley check it out....this is not the only issue we friction with.
I'll keep on looking to see what I can find on changing the date format in the table itself....
Last edited by vous; 08-28-2003 at 03:22 AM.
|
|
|
08-28-2003, 03:39 AM
|
#6
|
Member
Registered: Aug 2003
Location: Belgium
Distribution: Debian (server), Kubuntu (desktop)
Posts: 248
Rep:
|
Good luck, and let me know if you find anything!
|
|
|
08-28-2003, 04:42 AM
|
#7
|
Member
Registered: Mar 2003
Location: Macondo
Distribution: Mandrake 9.1, 10.1, SuSE 8.1 pro, 10.1, Red Hat 8.0/9.0
Posts: 380
Original Poster
Rep:
|
Thanks and I will!
|
|
|
09-03-2003, 05:40 AM
|
#8
|
Member
Registered: Aug 2003
Distribution: Slackware
Posts: 178
Rep:
|
I am using the excellent EMS MySQL Manager here in the field management you can easily change the date format no problems.
http://www.ems-hitech.com/index.phtml
Brilliant software.
Also according to previous posting above:-
SELECT DATE_FORMAT(dated,'%d/%m/%y') FROM info;
This works fine on my system.
Last edited by buttersoft; 09-03-2003 at 05:45 AM.
|
|
|
09-03-2003, 06:30 AM
|
#9
|
Member
Registered: Aug 2003
Location: Belgium
Distribution: Debian (server), Kubuntu (desktop)
Posts: 248
Rep:
|
Quote:
I am using the excellent EMS MySQL Manager here in the field management you can easily change the date format no problems.
|
Although this software changes the date format at presentation level, the format in the database stays the same.
|
|
|
All times are GMT -5. The time now is 03:56 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|