pythondatetimearrow-python

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

Solution

  • thanks kayluhb. update is to use shift:

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

    you can use replace:

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