473,769 Members | 3,828 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mysql Date Format

13 New Member
Can anyone plz advice, how to change mysql date format to (d-m-Y) permanently
which will affect all the databases in the mysql server. i.e, i want to change the date format in one place which will affect all the database's date format automaticly?

Is there any way out? Or code?
Sep 1 '08 #1
2 5647
Atli
5,058 Recognized Expert Expert
Hi.

MySQL will always display Date values in the "YYYY-MM-DD" format.
You can't change that, and even if you could, it would be a horrible idea.

You can, however, use the DATE_FORMAT function to re-format the date before using it.

But I wouldn't do that. You really shouldn't alter the data your database returns. It is far more consistent to have MySQL return data in it's default format and have your application (like say PHP code) format the data before using it.
Sep 1 '08 #2
tariquetuku
13 New Member
Hi.

MySQL will always display Date values in the "YYYY-MM-DD" format.
You can't change that, and even if you could, it would be a horrible idea.

You can, however, use the DATE_FORMAT function to re-format the date before using it.

But I wouldn't do that. You really shouldn't alter the data your database returns. It is far more consistent to have MySQL return data in it's default format and have your application (like say PHP code) format the data before using it.
Thanks Atli,

I get it.
Sep 2 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
4425
by: Neil | last post by:
Hi, I hope this question isn't too far off topic....I'm almost at my wits end trying to figure this out. I have a Mysql database and I wish to automate the backup of the database because I don't wish to rely on the web host doing so. I am using the "dbsender.php" script, which is written for this exact purpose (available at hotscripts.com). If I execute the script via my browser, the database is emailed to me in a 'gzip' format, which...
1
9471
by: Bruce | last post by:
I have an application where I would like to be able to allow the user to specify the date format used throughout the program (for internationalization). Then, on a date entry field, I can specify the date format on a MySQL SELECT to get the date in the proper format. The Javascript date selector I am using allows me to specify the format for selecting the date.
4
7082
by: RT | last post by:
If anyone can help that would be great. I¹m trying to format a timestamp from my MySQL table (sessions) Here¹s the code I¹m using: <?php echo date('D,n-j-y h:i:s a',strtotime($row_rsSessions)); ?> If I give the timestamp a value of 8 I can get the date to work correctly
1
24608
by: Neal | last post by:
I have a MySQL table with a datetime field that stamps the time the user submitted the form. It works and looks like this: $sql = "INSERT INTO table VALUES(....now())"; On another php page to view results, the code: printf("<br><td> %s</td>\n", $newArray);
2
1536
by: Phil Nospam | last post by:
Hello all, I was browsing through the reference manual on the mysql.com web site and found the following code examples for some date/time functions: mysql> SELECT STR_TO_DATE('00/00/0000', '%m/%d/%Y'); -> '0000-00-00' mysql> SELECT STR_TO_DATE('04/31/2004', '%m/%d/%Y'); -> '2004-04-31'
2
17390
by: Paul | last post by:
I am trying to insert a date into a mysql table but everytime I attempt it the date field is always empty. The field is of Date type and the date in code is in European format dd/mm/yyyy. Does the date have to be formatted in any particualr way from vb.net.
4
3334
by: Dan Lewis | last post by:
I've imported a ms access database into a table in a mysql database. The access database contains a field that holds date/time values in 'general date' format. These all show up at 01/01/1970 in the mysql database. I believe the field in mysql is wanting UTC and shows numbers when looked at from the sql command line (i.e. March 13, 2006, 5:31 pm is shown as 1142289086). How do I get the access data into that format so it will import...
1
2254
by: jimmy | last post by:
I'm trying to insert a date into a MySQL date column. The string i am trying to insert takes the following format: 2007-02-23 which corresponds to the date format that MySQL uses which is YYYY-MM- DD. When i insert this into the database through an INSERT query however the date field uses the value 0000-00-00. Why might this be? Thanks
12
4444
by: mantrid | last post by:
Hello Can anyone point me in the right direction for the way to read a text file a line at a time and separate the fields on that line and use them as data in an INSERT to add a record to a mysql table. Then read the second line in text file and repeat. Thanks for your time Ian
1
2526
by: paulq182 | last post by:
PLEASE HELP ME WITH MY CODE?? import java.sql.*; import java.io.*; class min_filmdb_rel_mysql { public static void main (String args ) throws SQLException, IOException {
0
9420
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10205
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9984
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8863
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3556
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2811
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.