I’m trying to parse some dates in a MySQL table and I cannot get STR_TO_DATE to play nicely:
SELECT STR_TO_DATE('Tue Feb 12 17:59:59 EET 2013', '%a %b %e %T EET %Y')
will return null.
How can I make it ignore the EET text? I don’t need the timezone information.
UPDATE: The MySQL server version is 4.1.14
I think it ONLY works on 5.x (tried on 5.5.x) because of parser which can skip matched templates in string while it was not implemented in 4.x.
You can try the following statement and it would be fine in 5.x but not 4.x:
So the best thing you can do is to follow your workaround (replace unwanted substring).
Sidenote: MySQL doesn’t have concept of time zones. So MySQL doesn’t care and doesn’t apply any changes during date conversion if initial string contains
UTC, EET, FETand so on.