简体   繁体   English

从箭头获取前一天的日期时间

[英]Getting previous day datetime from arrow

I can get current datetime from arrow like this: 我可以像这样从箭头获取当前日期时间:

arrow.utcnow().date()

or 要么

arrow.get('2017-02-01').date()

How can I get the previous day datetime? 如何获得前一天的日期时间? This does not work: 这不起作用:

arrow.utcnow().date() - 1

or 要么

 arrow.get('2017-02-01').date() - 1

thanks kayluhb. 谢谢kayluhb。 update is to use shift: 更新是使用shift:

arrow.utcnow().shift(days=-1)

you can use replace: 您可以使用replace:

 arrow.utcnow().replace(days=-1)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM