获取当前 UTC 时间

  1. [[email protected].io]# python
  2. >>> from datetime import datetime
  3. >>> datetime.utcnow()
  4. datetime.datetime(2019, 11, 19, 4, 0, 25, 696578)

获取 10 分钟后的时间

  1. [[email protected].io]# python
  2. >>> from datetime import datetime, timedelta
  3. >>> now = datetime.utcnow()
  4. >>> now + timedelta(minutes=10)
  5. datetime.datetime(2019, 11, 19, 4, 11, 7, 81740)

datetime 转换成 string

string 转换成 datetime