[英]MySQL UTC Date format
I am pulling data from Twitter's API and the return date is UTC in the following form: 我从Twitter的API中提取数据,返回日期为UTC,格式如下:
Sat Jan 24 22:14:29 +0000 2009
2009年1月24日星期六22:14:29 +0000
Can MySQL handle this format specifically or do I need to transform it? MySQL可以专门处理这种格式,还是需要对其进行转换? I am pulling the data using Python.
我正在使用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: 是的,如果您不愿意在Python中对其进行转换,则MySQL可以使用
STR_TO_DATE()
函数进行处理,如以下示例所示:
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 . 您可能还需要检查可能的格式说明符的完整列表: MySQL:DATE_FORMAT 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.