MySQL Forums
Forum List  »  MySQL Workbench

Re: How to have MySQL return date in different format?
Posted by: Fran Lee
Date: October 29, 2017 06:27PM

OK, I created a new db named test with a table named mytable
4 columns
idMyTable
startDate
endDate
Project

Then I add 3 records and this query shows all 3 rows
SELECT * from mytable

# idmyTable, startDate, endDate, Project
'1', '2011-10-24 10:00:00', '2011-11-24 10:00:00', 'Project A'
'2', '2011-12-24 10:00:00', '2011-12-24 10:00:00', 'Project B'
'2', '2012-01-24 10:00:00', '2012-01-24 10:00:00', 'Project C'

BUT this query doesn't work
(thought it did before but I was looking in wrong place in Output panel)

SELECT DATE_FORMAT(startDate '%d %m %Y'), project FROM myTable;

Here is Output:

20:22:42 SELECT DATE_FORMAT(startDate '%d %m %Y'), project FROM myTable LIMIT 0, 10

Error Code: 1582. Incorrect parameter count in the call to native function 'DATE_FORMAT' 0.000 sec

I'm simply wanting to include the datetime in my query but have it display in Day-Month-Year format

thanks for any help.

PS I just saw query questions maybe should go in this section of the forum. I'll get it right next time.

Thanks again for any help.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: How to have MySQL return date in different format?
35
October 29, 2017 06:27PM


Sorry, only registered users may post in this forum.

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.