Python 时间 time

import time

print time.strftime("%Y-%m-%d")

import datetime print

datetime.datetime.now()

shell中  date '+%Y-%m-%d'

 

 

计算今天后的第N天?

import datetime

now = datetime.datetime.now()

delta = datetime.timedelta(days=3)

n_days = now + delta

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

输出:

2015-04-10 19:16:34

 参考

posted on 2015-04-18 16:33  寒星12345678999  阅读(130)  评论(1编辑  收藏  举报