我有一个叫做约会的模型,它的列datetime是一个DateTime字段,duration它是一个Integer字段,代表持续时间,以分钟为单位.现在我要检查,如果func.now()是与datetime任命和的总和datetime和duration
我目前正试图这样做,但我需要一个适用于PostgreSQL和SQLite的解决方案.
current_appointment = Appointment.query.filter(
Appointment.datetime.between(
func.now(),
func.timestampadd(
'MINUTES', Appointment.duration, func.now()
)
)
).limit(1).one_or_none()
Run Code Online (Sandbox Code Playgroud) 我正在尝试将日期时间字符串解析为DateTime对象,但是当我尝试这样做时,我正在获取此ParseError。我不知道发生了什么,有人可以帮我吗?
日期时间字符串: 09-January-2018 12:00:00
码: let date = DateTime::parse_from_str(date.trim(), "%d-%B-%Y %T");
datetime ×1
postgresql ×1
python ×1
python-3.x ×1
rust ×1
rust-chrono ×1
sqlalchemy ×1
sqlite ×1