I have a date column in varchar format. How can i change it to date format in mysql workbench?
-
Actually in the database i have three columns: birthdate, birthmonth and birthyear. I am using this query to get a birthday column-- SELECT * FROM ( SELECT customer no, Concat(birthYear,'-',birthMonth,'-',birthDay) AS dob from 'Tablename' group by customer no )A; now the date i am getting is in varchar format and i want to convert it in date format- yyyy-mm-dd. Please keep in mind that that if date or months are in single digit then there is no '0' before them. So if the date is 5th june 2012 then it is concatenated as 2012-6-5 but i want my final date as 2012-06-05. Please help
-
Answer:
Use http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_str-to-date Example: SELECT STR_TO_DATE('01,5,2013','%d,%m,%Y'); returns 2013-05-01
Franck Dernoncourt at Quora Visit the source
Related Q & A:
- How can I change a value in an array?Best solution by Stack Overflow
- How can I change a member's name?Best solution by Yahoo! Answers
- If I have a form, such as an application, how can I fill it out using my computer?Best solution by answers.yahoo.com
- HOW CAN I CHANGE MY NAME FROM MY ACCOUNT I MADE A MISTAKE?Best solution by Yahoo! Answers
- How Can I Change The Format Of 3gp to mp4?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.