搜:
datetime() python
参考:
python 时间模块小结(time and datetime) | 不懂真人
Python标准库02 时间与日期 (time, datetime包) – Vamei – 博客园
8.1. datetime — Basic date and time types — Python v2.7.8 documentation
8.1. datetime — Basic date and time types — Python 2.7.12 documentation
最后用:
from datetime import datetime, timedelta startDatetime = datetime.now() app.logger.debug(‘startDatetime=%s’, startDatetime) oneDayDelta = timedelta(days=1) app.logger.debug(‘oneDayDelta=%s’, oneDayDelta) endDatetime = startDatetime + oneDayDelta app.logger.debug(‘endDatetime=%s’, endDatetime) |
log:
DEBUG in db_create [db_create.py:79]: startDatetime=2016-08-23 17:28:48.249504 <div–<—————————————————————————— <div–<—————————————————————————— DEBUG in db_create [db_create.py:82]: oneDayDelta=1 day, 0:00:00 <div–<—————————————————————————— <div–<—————————————————————————— DEBUG in db_create [db_create.py:84]: endDatetime=2016-08-24 17:28:48.249504 |