# Python 时间日期

常用日期时间处理

```python
# -*- coding: UTF-8 -*-
from datetime import datetime, timedelta

if __name__ == '__main__':
    today = datetime.now()
    print(today)
    print(today.strftime("%d/%m/%y"))
    print(today.strftime("%A %d %B %Y"))

    # TODO(You): 请在此计算昨天和明天日期

    print(yesterday)
    print(nextday)
```

请选出下列实现，**不正确** 的选项。

## template

```python
from datetime import datetime, timedelta


if __name__ == '__main__':
    today = datetime.now()
    print(today)
    print(today.strftime("%d/%m/%y"))
    print(today.strftime("%A %d %B %Y"))

    yesterday = today + timedelta(days=-1)
    nextday = today + timedelta(days=1)

    print(yesterday)
    print(nextday)
```

## 答案

```python
yesterday = today + timedelta(weeks=0,days=1)
nextday = today + timedelta(weeks=0,days=-1)
```

## 选项

### A

```python
yesterday = today + timedelta(days=-1)
nextday = today + timedelta(days=1)
```

### B

```python
yesterday = today + timedelta(weeks=0,days=-1)
nextday = today + timedelta(weeks=0,days=1)
```

### C

```python
yesterday = today - timedelta(days=1)
nextday = today - timedelta(days=-1)
```
