Getting previous day datetime from arrow

2.7k Views Asked by At

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
1

There are 1 best solutions below

1
jero On BEST ANSWER

thanks kayluhb. update is to use shift:

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

you can use replace:

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