MySQL UTC Date format
I am pulling data from Twitter's API and the return date is UTC in the following form:
Sat Jan 24 22:14:29 +0000 2009
Can MySQL handle this format sp开发者_如何学Cecifically or do I need to transform it? I am pulling the data using Python.
Yes, if you are not willing to transform it in Python, MySQL can handle this with the STR_TO_DATE()
function, as in the following example:
INSERT INTO
your_table
VALUES (
STR_TO_DATE('Sat Jan 24 22:14:29 +0000 2009', '%a %b %d %H:%i:%s +0000 %Y')
);
You may also want to check the full list of possible format specifiers: MySQL: DATE_FORMAT.
精彩评论