troubleshooting Question

Convert 9/4/2011 8:44:31 (string) into MySQL date

Avatar of DrDamnit
DrDamnitFlag for United States of America asked on
1 Comment1 Solution456 ViewsLast Modified:
while I could write a script to do this in PHP, I am hoping there is a simple MySQL way to change date / times strings like this:

9/4/2011 8:44:31

that got imported as VARCHAR(35) into date time so that when I sort by that column in ascending order, it actually sorts properly.

I tried altering the table to change that column to a datatime type, but that ckilled the data. (I didn't think it would work, but hey... it's worth a try). Then I restored from a backup, and tried this:

SELECT *,DATE('Recieved') AS RealDate FROM `emails`

But that didn't work either....
Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros