[英]SQLAlchemy insert time to MySQL incorrectly
我定義了一個Column,它的類型是DateTime, Time, TIMESTAMP,不管它總是出現這樣的警告:
Warning: Incorrect time value: '2017-02-13 21:39:06.956895' for column 'time' at row 1
我已經用谷歌搜索了很長時間這樣的警告所以請不要向我解釋為什么進一步。插入后,這樣的列值顯示如下: 21:39:07
,但我想要的是: 2017-02-13 21:39:06
,所以任何人都可以給我一些簡單而適當的解決方案嗎? 謝謝。
這是使用 DateTime 的列定義: time = Column(DateTime(timezone=True), default=datetime.datetime.utcnow())
操作系統版本:OS X 10.11.4 Python 版本:3.5.2
它接受 datetime.datetime object。例如:
now = datetime.datetime.now()
會和你一起工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.