How to have MySQL return date in different format?
Posted by:
Fran Lee
Date: October 29, 2017 11:39AM
Working on a webiste using mySQL and it has been a long time since I've done this so I've got a lot of catchup to dd.
Experimenting writing queries in Workbench community 6.3.9with MySQL 5.7x on a Windows machine.
myTable
- idTable
- startDate
- endDate
- Project
I want to write a query that will display the date as day/month/year or something similar.
If I write the query as
SELECT startDate, project FROM myTable;
it works
But my attempts to use CONVERT() to have the date returned and displayed in any format fails... does CONVERT() do that in MySQL?
I've made the query run successfully in Workbench as..
SELECT DATE_FORMAT(startDate '%d %m %Y'), project FROM myTable;
the query runs
BUT... nothing is displayed.
What is the proper way to do this? Or should I just use PHP to manage date conversion, formatting, etc?
thanks for any help.
2013-09-13 00:00:00
Subject
Views
Written By
Posted
How to have MySQL return date in different format?
954
October 29, 2017 11:39AM
436
October 29, 2017 02:33PM
2440
October 29, 2017 06:27PM
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.