用于处理日期/时间的 Python 库,设计灵感同样是来源于 moment.js 和 requests ,设计理念源自 Times Python 模块。
Usage
import moment from datetime import datetime # Create a moment from a string moment.date("12-18-2012") # Create a moment with a specified strftime format moment.date("12-18-2012", "%m-%d-%Y") # Moment uses the awesome dateparser library behind the scenes moment.date("2012-12-18") # Create a moment with words in it moment.date("December 18, 2012") # Create a moment that would normally be pretty hard to do moment.date("2 weeks ago") # Create a future moment that would otherwise be really difficult moment.date("2 weeks from now") # Create a moment from the current datetime moment.now() # The moment can also be UTC-based moment.utcnow() # Cr