MySQL Forums
Forum List  »  MySQL for Excel

Re: set date format for column
Posted by: Peter Brawley
Date: August 03, 2011 09:51AM

Quote

Its not an excel question. Its just through excel that I upload to sql. I need to format the date in sql. As I said above it doesn't matter how its formatted in excel mysql always shows 1/1/2001.

MySQL stores dates in international yyyymmdd format. Mercifully, you cannot change that. It expects dates in such a format, but it is also a bit forgiving, ie it accepts 'yyyy-mm-dd','yyyy-m-d','yyyy/mm/dd' &c.

LOAD DATA INFILE therefore requires dates in such a format. You can fiddle using variables, but unless you know what you're doing, it's much easier to change what your spreadsheet is feedibng LOAD DATA INFILE.

The MySQL default date display format is also international, yyyy-mm-dd. To change how a particlar date value is displayed, use the MySQL Date_Format() function, documentation of which describes all arguments and formats that it understands.

PB
http://www.artfulsoftware.com

Options: ReplyQuote


Subject
Views
Written By
Posted
4962
August 03, 2011 02:09AM
2103
August 03, 2011 05:53AM
1761
August 03, 2011 09:31AM
Re: set date format for column
2328
August 03, 2011 09:51AM
1578
August 03, 2011 11:48AM
1376
August 03, 2011 12:04PM
1579
August 03, 2011 12:23PM
1473
August 03, 2011 01:45PM
1431
August 04, 2011 11:55PM
1361
August 03, 2011 09:33AM
1420
August 03, 2011 09:43AM
1383
August 03, 2011 11:40AM
1424
August 03, 2011 01:47PM
1530
August 03, 2011 01:01PM
1484
August 03, 2011 01:08PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.