Question: Is there a simple way to state that 

```
a = '2020-01-01 19:30:33.996628' 
b = '2020-01-01 19:30:34' 

```

`a` and `b` are equal. If the time resolution of `a` is changed to second, then `a` could be equal to `b`. How to implement it with code?

Answer: 
if you treat both of them as `datetime` objects, you can use arithmetic operators on them. For example, you can subtract them and check if the result satisfy a condition (like less then one minute different) as you wise
Set to next second
------------------

* Add the `timedelta` difference between `1e6` and `a.microsecond`

```
from datetime import timedelta, datetime

a = datetime.fromisoformat('2020-01-01 19:30:33.996628')

a = a + timedelta(microseconds=(1e6 - a.microsecond))

print(a)

>>> datetime.datetime(2020, 1, 1, 19, 30, 34)

print(a.strftime('%Y-%m-%d %H:%M:%S'))

>>> 2020-01-01 19:30:34

```

Set to current second
---------------------

* With `.replace(microsecond=0)`

```py
from datetime import datetime

a = datetime.fromisoformat('2020-01-01 19:30:33.996628')

print(a)

>>> datetime.datetime(2020, 1, 1, 19, 30, 33, 996628)

a = a.replace(microsecond=0)

print(a)

>>> datetime.datetime(2020, 1, 1, 19, 30, 33)

```