I would like to convert strings such as "Tue, 15 May 2012 17:26:44 EST" into UTC dates, so that I can then convert them into UNIX timestamps.
I tried the following but can’t see a parameter for timezones in the MySQL documentation
SELECT STR_TO_DATE("Tue, 15 May 2012 17:26:44 EST", "%a, %d-%b-%Y %T");
I think I can also use COVERT_TZ() but the records could be any timezone so I’m not sure how to to determine the parameters.
2
Answers
Using CONVERT_TZ you can get the last word from your string (which hopefully is always the time zone) and convert it to UTC:
An alternative to VvdL answer:
All you need is to do string manipulation, which you can do in many ways. The freaking
"
took my time to notice.Fiddle: https://www.db-fiddle.com/f/2fH64kfq78D2f1aBekqRKQ/0