开发者

MySQL UTC Date format

开发者 https://www.devze.com 2022-12-23 07:58 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消